Skip to content

Commit f7bb2a6

Browse files
committed
Use checked out SHA hash when uploading code scanning result
1 parent df92ca1 commit f7bb2a6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/static-analysis.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
with:
3535
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
3636

37+
- name: "Get SHA hash of checked out ref"
38+
if: ${{ github.event_name == 'workflow_dispatch' }}
39+
run: |
40+
echo CHECKED_OUT_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV
41+
3742
- name: "Setup"
3843
uses: "./.github/actions/setup"
3944
with:
@@ -44,7 +49,15 @@ jobs:
4449
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --report=psalm.sarif"
4550

4651
- name: "Upload SARIF report"
52+
if: ${{ github.event_name != 'workflow_dispatch' }}
4753
uses: "github/codeql-action/upload-sarif@v3"
4854
with:
4955
sarif_file: psalm.sarif
50-
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
56+
57+
- name: "Upload SARIF report"
58+
if: ${{ github.event_name == 'workflow_dispatch' }}
59+
uses: "github/codeql-action/upload-sarif@v3"
60+
with:
61+
sarif_file: psalm.sarif
62+
ref: ${{ inputs.ref }}
63+
sha: ${{ env.CHECKED_OUT_SHA }}

0 commit comments

Comments
 (0)