Skip to content

Commit 96454bb

Browse files
use github-script to upload sarif results
1 parent d150855 commit 96454bb

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

.github/workflows/periodic-zizmor.yaml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,41 @@ jobs:
8989
./target
9090
> results.sarif
9191
92+
- name: Repository Info
93+
id: repo-info
94+
working-directory: ./target
95+
run: |
96+
SHA=$(git rev-parse HEAD)
97+
REF=$(git rev-parse --symbolic-full-name HEAD)
98+
99+
echo "sha=${SHA}" >> $GITHUB_OUTPUT
100+
echo "ref=${REF}" >> $GITHUB_OUTPUT
101+
102+
- name: Prepare SARIF results
103+
id: prepare-sarif
104+
run: |
105+
RESULTS=$(gzip -c results.sarif | base64 -w 0)
106+
echo "results=${RESULTS}" >> $GITHUB_OUTPUT
107+
92108
- name: Upload SARIF results
93-
uses: github/codeql-action/[email protected]
109+
uses: actions/github-script@v7
110+
env:
111+
OWNER: ${{ matrix.repository.owner }}
112+
REPO: ${{ matrix.repository.repo }}
113+
SHA: ${{ steps.repo-info.outputs.sha }}
114+
REF: ${{ steps.repo-info.outputs.ref }}
115+
SARIF_RESULTS: ${{ steps.prepare-sarif.outputs.results }}
94116
with:
95-
sarif_file: ./results.sarif
96-
token: ${{ steps.get-token.outputs.token }}
97-
external-repository-token: ${{ steps.get-token.outputs.token }}
98-
checkout_path: ./target
99-
category: zizmor-periodic
117+
github-token: ${{ steps.get-token.outputs.token }}
118+
script: |
119+
const { OWNER, REPO, SHA, REF, SARIF_RESULTS } = process.env;
120+
121+
const response = await github.rest.codeScanning.uploadSarif({
122+
owner: OWNER,
123+
repo: REPO,
124+
commit_sha: SHA,
125+
ref: REF,
126+
sarif: SARIF_RESULTS,
127+
});
128+
129+
console.log(response.status);

0 commit comments

Comments
 (0)