From 9b400bd56544dc15c236169446905fbab5e1ec0a Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Mon, 14 Sep 2026 11:11:20 -0400 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=92=20security(ci):=20harden=20and?= =?UTF-8?q?=20optimize=20GitHub=20Actions=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add missing harden-runner egress auditing to Deploy Zensical and Validate Zensical - Add timeout-minutes to jobs across all workflows to prevent runaway runs - Replace unmaintained antonyurchenko/git-release with SHA-pinned softprops/action-gh-release, extracting the matching CHANGELOG.md section for release notes - Fix Publish Release push trigger (paths filter is unreliable on tag pushes) and scope contents:write permission to the job level - Fix stale workflow_run reference to the retired 'Build Module' workflow name - Remove dead pull_request condition in scorecard.yml (no such trigger exists) - Clean up stale comments and dead commented-out triggers in Format Markdown and Validate Module Manifest (left intentionally manual-only) - Add missing version comment to SHA-pinned codacy-analysis-cli-action Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/Auto-Assign.yml | 1 + .github/workflows/Build External Help.yml | 3 +- .github/workflows/Build Module.yml | 1 + .github/workflows/Deploy Zensical.yml | 10 +++++ .github/workflows/Format Markdown.yml | 3 +- .github/workflows/Publish Release.yml | 37 ++++++++++++++----- .../workflows/Update MkDocs Navigation.yml | 1 + .../workflows/Validate Module Manifest.yml | 16 +------- .github/workflows/Validate Zensical.yml | 5 +++ .github/workflows/codacy.yml | 3 +- .github/workflows/dependency-review.yml | 1 + .github/workflows/scorecard.yml | 3 +- .github/workflows/summary.yml | 1 + 13 files changed, 58 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Auto-Assign.yml b/.github/workflows/Auto-Assign.yml index 48b3ada8..c446d0d3 100644 --- a/.github/workflows/Auto-Assign.yml +++ b/.github/workflows/Auto-Assign.yml @@ -10,6 +10,7 @@ permissions: # added using https://github.com/step-security/secure-repo jobs: run: runs-on: ubuntu-latest + timeout-minutes: 5 permissions: issues: write pull-requests: write diff --git a/.github/workflows/Build External Help.yml b/.github/workflows/Build External Help.yml index f7a221e7..8c6c1bff 100644 --- a/.github/workflows/Build External Help.yml +++ b/.github/workflows/Build External Help.yml @@ -3,7 +3,7 @@ name: ๐Ÿ“š Create External Help on: # Run after the 'Build Module' workflow completes. workflow_run: - workflows: ["Build Module", "๐Ÿ‘ท Build Module"] + workflows: ["๐Ÿ‘ท Build Module"] types: - completed @@ -25,6 +25,7 @@ jobs: if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} # The New-ExternalHelpCab cmdlet uses makecab, which depends on Windows. runs-on: windows-latest + timeout-minutes: 15 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 diff --git a/.github/workflows/Build Module.yml b/.github/workflows/Build Module.yml index 7c15cf76..fa22eb2c 100644 --- a/.github/workflows/Build Module.yml +++ b/.github/workflows/Build Module.yml @@ -21,6 +21,7 @@ jobs: test: name: ๐Ÿงช Run Tests and Build runs-on: ubuntu-latest + timeout-minutes: 15 concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/Deploy Zensical.yml b/.github/workflows/Deploy Zensical.yml index da6e660e..52b3ec1d 100644 --- a/.github/workflows/Deploy Zensical.yml +++ b/.github/workflows/Deploy Zensical.yml @@ -25,6 +25,11 @@ jobs: pages: write steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: โœ… Checkout Repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -66,6 +71,11 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: โœ… Ensure deployment run is current branch head id: current-head-check uses: actions/github-script@d746ffe35508b1917358783b479e04febd2b8f71 # v9.0.0 diff --git a/.github/workflows/Format Markdown.yml b/.github/workflows/Format Markdown.yml index f5850a10..61c616a9 100644 --- a/.github/workflows/Format Markdown.yml +++ b/.github/workflows/Format Markdown.yml @@ -1,4 +1,4 @@ -# Formats markdown files in docs/ using Prettier on push or manual trigger +# Formats markdown files in docs/ using Prettier. Manual trigger only (workflow_dispatch). name: ๐Ÿ–ผ๏ธ Format Markdown on: @@ -10,6 +10,7 @@ permissions: jobs: format: runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write steps: diff --git a/.github/workflows/Publish Release.yml b/.github/workflows/Publish Release.yml index 6836a017..52251948 100644 --- a/.github/workflows/Publish Release.yml +++ b/.github/workflows/Publish Release.yml @@ -4,12 +4,10 @@ name: ๐Ÿท๏ธ Publish from Changelog Tag # matches this tag and publish a new GitHub release with it, then publish the module to the PowerShell Gallery. on: push: + # `paths` filters aren't reliably applied to tag pushes, so this trigger is scoped to + # version tags only; the job's `if` guard below double-checks the ref is a tag. tags: - 'v*.*.*' - branches: - - main - paths: - - 'CHANGELOG.md' # Allows manual triggering of the workflow. workflow_dispatch: @@ -20,7 +18,7 @@ concurrency: cancel-in-progress: true permissions: - contents: write + contents: read jobs: release: @@ -28,6 +26,9 @@ jobs: # Only run if the commit contains a tag if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: write steps: - name: Harden the runner (Audit all outbound calls) @@ -38,14 +39,32 @@ jobs: - name: โœ… Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: ๐Ÿ“ Extract Changelog Section + id: changelog + shell: bash + run: | + set -euo pipefail + version="${GITHUB_REF_NAME#v}" + awk -v ver="$version" ' + $0 ~ "^## \\[" ver "\\]" { found=1; print; next } + found && /^## \[/ { exit } + found { print } + ' CHANGELOG.md > RELEASE_NOTES.md + if [ ! -s RELEASE_NOTES.md ]; then + echo "::error::No CHANGELOG.md section found matching version $version" + exit 1 + fi + - name: ๐Ÿ“ฆ Create GitHub Release - # Creates a new release from a changelog section that matches a commit tag (eg: v1.2.5) - uses: docker://antonyurchenko/git-release:latest@sha256:499561e8dc416d976f1b130584f3bdb9ba2129c9c871449b007a3c4dd7a5eb08 + # Creates a new release using the changelog section matching the pushed tag (eg: v1.2.5) + uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} with: - args: | - artifacts\\${{ GitHub.repository }}.zip + body_path: RELEASE_NOTES.md + files: | + artifacts/**/*.zip + src/Archive/**/*.zip - name: ๐Ÿš€ Publish PowerShell Module env: diff --git a/.github/workflows/Update MkDocs Navigation.yml b/.github/workflows/Update MkDocs Navigation.yml index 50d0b5b2..8c249508 100644 --- a/.github/workflows/Update MkDocs Navigation.yml +++ b/.github/workflows/Update MkDocs Navigation.yml @@ -19,6 +19,7 @@ permissions: jobs: update-navigation: runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write concurrency: diff --git a/.github/workflows/Validate Module Manifest.yml b/.github/workflows/Validate Module Manifest.yml index 307dd41b..cba0a024 100644 --- a/.github/workflows/Validate Module Manifest.yml +++ b/.github/workflows/Validate Module Manifest.yml @@ -1,21 +1,8 @@ name: ๐Ÿ” Validate Module Manifest on: + # Intentionally manual-only for now; not wired to pull_request/push triggers. workflow_dispatch: - #pull_request: - # branches: - # - main - # - prerelease - # paths: - # - "src/PSPreworkout/Public/**" - # - "src/PSPreworkout/PSPreworkout.psd1" - #push: - # branches: - # - main - # - prerelease - # paths: - # - "src/PSPreworkout/Public/**" - # - "src/PSPreworkout/PSPreworkout.psd1" permissions: contents: read @@ -24,6 +11,7 @@ jobs: validate-manifest: name: ๐Ÿงช Validate and Update Manifest runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write pull-requests: write diff --git a/.github/workflows/Validate Zensical.yml b/.github/workflows/Validate Zensical.yml index bb7144b6..f8bd0a45 100644 --- a/.github/workflows/Validate Zensical.yml +++ b/.github/workflows/Validate Zensical.yml @@ -19,6 +19,11 @@ jobs: timeout-minutes: 15 steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 + with: + egress-policy: audit + - name: โœ… Checkout Repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index 1fe6c51e..62d20d90 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -33,6 +33,7 @@ jobs: actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status name: Codacy Security Scan runs-on: ubuntu-latest + timeout-minutes: 15 steps: # Checkout the repository to the GitHub Actions runner - name: Harden the runner (Audit all outbound calls) @@ -45,7 +46,7 @@ jobs: # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis - name: Run Codacy Analysis CLI - uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b + uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b # 1.1.0 with: # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository # You can also omit the token and run the tools that support default configurations diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 0001b798..603a33a3 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -26,6 +26,7 @@ permissions: jobs: dependency-review: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index a33bfa95..4d1b3177 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -21,8 +21,9 @@ jobs: analysis: name: Scorecard analysis runs-on: ubuntu-latest + timeout-minutes: 15 # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled. - if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request' + if: github.event.repository.default_branch == github.ref_name permissions: # Needed to upload the results to code-scanning dashboard. security-events: write diff --git a/.github/workflows/summary.yml b/.github/workflows/summary.yml index db5c436e..2082de2d 100644 --- a/.github/workflows/summary.yml +++ b/.github/workflows/summary.yml @@ -10,6 +10,7 @@ permissions: jobs: summary: runs-on: ubuntu-latest + timeout-minutes: 5 permissions: issues: write models: read From ec3088a927e2b585ce233e879ff2d5be0f878a38 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Mon, 14 Sep 2026 12:06:39 -0400 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20build=20and=20arc?= =?UTF-8?q?hive=20module=20before=20attaching=20to=20GitHub=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Publish Release.yml referenced artifacts/**/*.zip and src/Archive/**/*.zip without ever producing them in this workflow, so softprops/action-gh-release would silently create a release with no attached package. Add the bootstrap + Invoke-Build steps (matching Build Module.yml) to actually build and archive the module first, point at the real output path, and set fail_on_unmatched_files: true so this can't silently regress again. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/Publish Release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Publish Release.yml b/.github/workflows/Publish Release.yml index 52251948..7d11a2fa 100644 --- a/.github/workflows/Publish Release.yml +++ b/.github/workflows/Publish Release.yml @@ -55,6 +55,15 @@ jobs: exit 1 fi + - name: ๐Ÿฅพ Bootstrap + shell: pwsh + run: .\src\actions_bootstrap.ps1 + + - name: ๐Ÿ‘ทโ€โ™‚๏ธ Build Module Archive + # Produces the .\src\Archive\*.zip package that the release step attaches below. + shell: pwsh + run: Invoke-Build -File .\src\PSPreworkout.build.ps1 + - name: ๐Ÿ“ฆ Create GitHub Release # Creates a new release using the changelog section matching the pushed tag (eg: v1.2.5) uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 @@ -62,9 +71,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} with: body_path: RELEASE_NOTES.md - files: | - artifacts/**/*.zip - src/Archive/**/*.zip + files: src/Archive/*.zip + fail_on_unmatched_files: true - name: ๐Ÿš€ Publish PowerShell Module env: From ac3582fe532fbbcfaa157475dff9f0d9ef26d499 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Mon, 14 Sep 2026 12:10:52 -0400 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20exclude=20test=20?= =?UTF-8?q?reports=20from=20released=20module=20archive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Splitting the Invoke-Build call into pre-Archive tasks + an explicit cleanup step + the Archive task so Artifacts/ccReport and Artifacts/testOutput (Pester/coverage output) are removed before the release zip is created, keeping CI reports out of the published package. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/Publish Release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Publish Release.yml b/.github/workflows/Publish Release.yml index 7d11a2fa..a9380f4e 100644 --- a/.github/workflows/Publish Release.yml +++ b/.github/workflows/Publish Release.yml @@ -59,10 +59,23 @@ jobs: shell: pwsh run: .\src\actions_bootstrap.ps1 - - name: ๐Ÿ‘ทโ€โ™‚๏ธ Build Module Archive + - name: ๐Ÿ‘ทโ€โ™‚๏ธ Build Module + # Run every task except Archive so the module is built and tested first. + shell: pwsh + run: Invoke-Build -Task Clean, ValidateRequirements, ImportModuleManifest, FormattingCheck, Analyze, Test, CreateHelpStart, Build, IntegrationTest -File .\src\PSPreworkout.build.ps1 + + - name: ๐Ÿงน Remove Test Reports from Artifacts + # ccReport/testOutput are test-run artifacts, not part of the shipped module; + # strip them before archiving so the release package only contains the module. + shell: pwsh + run: | + Remove-Item -Path '.\src\Artifacts\ccReport' -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path '.\src\Artifacts\testOutput' -Recurse -Force -ErrorAction SilentlyContinue + + - name: ๐Ÿ“ฆ Archive Module # Produces the .\src\Archive\*.zip package that the release step attaches below. shell: pwsh - run: Invoke-Build -File .\src\PSPreworkout.build.ps1 + run: Invoke-Build -Task Archive -File .\src\PSPreworkout.build.ps1 - name: ๐Ÿ“ฆ Create GitHub Release # Creates a new release using the changelog section matching the pushed tag (eg: v1.2.5)