Skip to content

Commit e5c104a

Browse files
committed
workflows/actionlint: fix SARIF file upload (again)
The `upload-sarif` workflow needs `security-events: write` permissions.[^1][^2] To avoid having elevated permissions for everything else we're doing here, let's run it in its own job. [^1]: https://github.com/github/codeql-action#workflow-permissions [^2]: https://github.com/Homebrew/homebrew-core/actions/runs/11586292844/job/32256646365#step:9:24
1 parent 86ad983 commit e5c104a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/actionlint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ env:
2323
HOMEBREW_NO_AUTO_UPDATE: 1
2424
HOMEBREW_NO_ENV_HINTS: 1
2525

26+
permissions: {}
27+
2628
jobs:
2729
workflow_syntax:
2830
if: github.repository_owner == 'Homebrew'
@@ -52,6 +54,12 @@ jobs:
5254
5355
- run: zizmor --format sarif . >results.sarif
5456

57+
- name: Upload SARIF file
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: results.sarif
61+
path: results.sarif
62+
5563
- name: Set up actionlint
5664
run: |
5765
# Setting `shell: /bin/bash` prevents shellcheck from running on
@@ -63,6 +71,19 @@ jobs:
6371
6472
- run: actionlint
6573

74+
upload_sarif:
75+
needs: workflow_syntax
76+
runs-on: ubuntu-latest
77+
permissions:
78+
contents: read
79+
security-events: write
80+
steps:
81+
- name: Download SARIF file
82+
uses: actions/download-artifact@v4
83+
with:
84+
name: results.sarif
85+
path: results.sarif
86+
6687
- name: Upload SARIF file
6788
uses: github/codeql-action/upload-sarif@v3
6889
with:

0 commit comments

Comments
 (0)