Skip to content

Commit 233e0b0

Browse files
07souravkundaclaude
andcommitted
Don't turn the upload job red when no SARIF was ever produced
Review nit: if the container job dies before `semgrep ci` runs — a container-pull failure, or checkout failing — no SARIF is written, and the upload job then went red on "artifact not found", pointing a debugger at the download step instead of at the real upstream cause. Two reds where the pre-split workflow showed one. Tolerate the missing artifact and skip the upload when there is no file. The normal case is unaffected: `semgrep ci` exiting 1 on blocking findings still writes the SARIF, still uploads it, and still reaches the dashboard. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 8b08eb9 commit 233e0b0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/Semgrep.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,20 @@ jobs:
7272
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
7373

7474
steps:
75+
# Tolerate a missing artifact. If the semgrep job died BEFORE `semgrep ci` ran — a
76+
# container-pull failure, or checkout failing — no SARIF was ever written, and this
77+
# job should not add a second red pointing at artifact download when the real cause
78+
# is upstream. The container job's own failure already tells that story.
79+
# (`semgrep ci` exiting 1 on blocking findings is the normal case: the SARIF exists,
80+
# the artifact uploads, and the upload below runs as usual.)
7581
- name: Download SARIF artifact
7682
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
7783
with:
7884
name: semgrep-sarif
85+
continue-on-error: true
7986

8087
- name: Upload SARIF file for GitHub Advanced Security Dashboard
8188
uses: github/codeql-action/upload-sarif@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0
8289
with:
8390
sarif_file: semgrep.sarif
91+
if: hashFiles('semgrep.sarif') != ''

0 commit comments

Comments
 (0)