Skip to content

Commit 155bd70

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/static-analysis.yml

Lines changed: 20 additions & 0 deletions
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:
@@ -48,3 +53,18 @@ jobs:
4853
with:
4954
sarif_file: psalm.sarif
5055
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
56+
sha: ${{ github.event_name == 'workflow_dispatch' && env.CHECKED_OUT_SHA || github.sha }}
57+
58+
- name: "Upload SARIF report"
59+
if: ${{ github.event_name != 'workflow_dispatch' }}
60+
uses: "github/codeql-action/upload-sarif@v3"
61+
with:
62+
sarif_file: psalm.sarif
63+
64+
- name: "Upload SARIF report"
65+
if: ${{ github.event_name == 'workflow_dispatch' }}
66+
uses: "github/codeql-action/upload-sarif@v3"
67+
with:
68+
sarif_file: psalm.sarif
69+
ref: ${{ inputs.ref }}
70+
sha: ${{ env.CHECKED_OUT_SHA }}

0 commit comments

Comments
 (0)