Skip to content

Commit 450f2ad

Browse files
committed
Remove unneeded GH perms
Reduce perms to least-necessary Remove merge_queue.yml since it's never been used and is now stale Remove comment-artifact, it hasn't worked in ages.
1 parent 0ad1b66 commit 450f2ad

12 files changed

+23
-396
lines changed

.github/workflows/build_debian_src.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ on:
1616
type: string
1717

1818
permissions:
19-
contents: write
20-
packages: write
19+
contents: read
2120

2221
jobs:
2322
build-debian-src:

.github/workflows/build_one_target.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787

8888
gather-artifacts:
8989
permissions:
90-
contents: write
90+
contents: read
9191
pull-requests: write
9292
runs-on: ubuntu-latest
9393
needs: [version, build]

.github/workflows/daily_packaging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
- .github/workflows/hook_copr.yml
1717

1818
permissions:
19-
contents: write
19+
contents: read
2020
packages: write
2121

2222
jobs:

.github/workflows/docker_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ on:
3737
value: ${{ jobs.docker-build.outputs.digest }}
3838

3939
permissions:
40-
contents: write
40+
contents: read
4141
packages: write
4242

4343
jobs:

.github/workflows/docker_manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
type: string
1313

1414
permissions:
15-
contents: write
15+
contents: read
1616
packages: write
1717

1818
jobs:

.github/workflows/hook_copr.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ on:
1111
type: string
1212

1313
permissions:
14-
contents: write
15-
packages: write
14+
contents: read
1615

1716
jobs:
1817
build-copr-hook:

.github/workflows/main_matrix.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828

2929
workflow_dispatch:
3030

31+
permissions: read-all
32+
3133
jobs:
3234
setup:
3335
strategy:
@@ -123,9 +125,16 @@ jobs:
123125

124126
test-native:
125127
if: ${{ !contains(github.ref_name, 'event/') && github.repository == 'meshtastic/firmware' }}
128+
permissions: # Needed for dorny/test-reporter.
129+
contents: read
130+
actions: read
131+
checks: write
126132
uses: ./.github/workflows/test_native.yml
127133

128134
docker:
135+
permissions: # Needed for pushing to GHCR.
136+
contents: read
137+
packages: write
129138
strategy:
130139
fail-fast: false
131140
matrix:
@@ -150,9 +159,6 @@ jobs:
150159
gather-artifacts:
151160
# trunk-ignore(checkov/CKV2_GHA_1)
152161
if: github.repository == 'meshtastic/firmware'
153-
permissions:
154-
contents: write
155-
pull-requests: write
156162
strategy:
157163
fail-fast: false
158164
matrix:
@@ -225,13 +231,6 @@ jobs:
225231
path: ./*.elf
226232
retention-days: 30
227233

228-
- uses: scruplelesswizard/comment-artifact@main
229-
if: ${{ github.event_name == 'pull_request' }}
230-
with:
231-
name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}
232-
description: "Download firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip. This artifact will be available for 90 days from creation"
233-
github-token: ${{ secrets.GITHUB_TOKEN }}
234-
235234
shame:
236235
if: github.repository == 'meshtastic/firmware'
237236
continue-on-error: true
@@ -275,6 +274,8 @@ jobs:
275274
# run: python3 bin/shame.py ${{ github.event.pull_request.number }} manifests-old/ manifests-new/
276275

277276
release-artifacts:
277+
permissions: # Needed for 'gh release upload'.
278+
contents: write
278279
runs-on: ubuntu-latest
279280
if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'meshtastic/firmware' }}
280281
outputs:
@@ -366,6 +367,8 @@ jobs:
366367
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
367368

368369
release-firmware:
370+
permissions: # Needed for 'gh release upload'.
371+
contents: write
369372
strategy:
370373
fail-fast: false
371374
matrix:

0 commit comments

Comments
 (0)