From d2dcebc6ddf82faa8dec58805156a0266c2ad9ee Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:02:41 +0700 Subject: [PATCH] ci: address review and SonarCloud findings in workflows - release.yml: upload the Velopack release as a draft, attach SBOM + checksums, then publish (publishing is what makes installed copies auto-update); VirusTotal runs after publishing because the release-by-tag API cannot see drafts. - notify-ci-failure.yml: filter on the triggering event (`push`) instead of the forgeable actor login (SonarCloud githubactions:S8232). - scorecard.yml: top-level `contents: read` instead of `read-all` (githubactions:S8234). - codeql.yml: build with -p:RunAnalyzers=false; Roslyn analyzers add nothing to the extraction. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/codeql.yml | 3 ++- .github/workflows/notify-ci-failure.yml | 6 ++++-- .github/workflows/release.yml | 12 ++++++++++-- .github/workflows/scorecard.yml | 3 ++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ecbc7d1..5c76195 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -58,7 +58,8 @@ jobs: - if: matrix.build-mode == 'manual' name: Build - run: dotnet build CommandForge.slnx -c Release + # Roslyn analyzers add nothing to CodeQL's extraction and slow the traced build down. + run: dotnet build CommandForge.slnx -c Release -p:RunAnalyzers=false - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 diff --git a/.github/workflows/notify-ci-failure.yml b/.github/workflows/notify-ci-failure.yml index 48c4751..8efdcd1 100644 --- a/.github/workflows/notify-ci-failure.yml +++ b/.github/workflows/notify-ci-failure.yml @@ -16,9 +16,11 @@ permissions: jobs: notify: - # Dependabot-triggered runs get no Actions secrets, so the required webhook is unavailable. + # Build only runs on `push` for main, so this limits alerts to main without trusting + # forgeable values (branch names, actor logins) — and skips pull-request runs (including + # Dependabot's), which have no access to the webhook secret anyway. if: >- github.event.workflow_run.conclusion == 'failure' && - github.event.workflow_run.actor.login != 'dependabot[bot]' + github.event.workflow_run.event == 'push' uses: poli0981/.github/.github/workflows/notify-ci-failure.yml@main secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63c1492..f283d9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,7 +89,9 @@ jobs: Releases/*-Setup.exe Releases/*.nupkg - - name: Publish GitHub Release (Velopack) + # Upload as a DRAFT first: publishing is what makes installed copies auto-update, so the + # release only goes live once every asset (SBOM, checksums, scan links) is attached. + - name: Create draft GitHub Release (Velopack) shell: pwsh env: VERSION: ${{ steps.ver.outputs.version }} @@ -98,7 +100,6 @@ jobs: dotnet vpk upload github --repoUrl $env:REPO_URL --token $env:GH_TOKEN - --publish --releaseName "CommandForge $env:VERSION" --tag $env:TAG @@ -121,6 +122,13 @@ jobs: Out-File $checksums -Encoding ascii gh release upload $env:TAG $sbom $checksums --clobber + - name: Publish the release + shell: pwsh + env: + TAG: ${{ steps.ver.outputs.tag }} + run: gh release edit $env:TAG --draft=false --latest + + # The release-by-tag API used to append scan links can't see drafts, so this runs after publishing. - name: VirusTotal scan (optional) if: env.VT_API_KEY != '' uses: crazy-max/ghaction-virustotal@936d8c5c00afe97d3d9a1af26d017cfdf26800a2 # v5.0.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 26ce52f..05e2e11 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -10,7 +10,8 @@ on: branches: [main] workflow_dispatch: -permissions: read-all +permissions: + contents: read jobs: analysis: