Skip to content

Commit f2685ff

Browse files
committed
ci: scope GITHUB_TOKEN to write needs in 5 workflows
CodeQL flagged 5 workflows with no permissions block, so their GITHUB_TOKEN gets the repo default scope, wider than what each workflow's push or publish step needs. Add an explicit permissions block per workflow, matched to its own steps: - github-actions-cron-update-OR.yml: contents write, pull-requests write, and issues write (the PR gets a label, which GitHub serves through the issues API even for a PR). - github-actions-cron-update-yosys.yml: contents write and pull-requests write, same PR flow with no label. - github-actions-manual-update-rules.yml: contents write, for its direct commit and push. - github-actions-update-rules.yml: contents write and pull-requests write, for its two push paths. - github-actions-publish-docker-images.yml: one top-level block covering all 3 jobs, contents read and packages write, since all 3 push images to GHCR under the same scope. No workflow's steps change; this only makes each one's existing GITHUB_TOKEN use explicit instead of relying on the org default. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
1 parent 981bbcf commit f2685ff

5 files changed

Lines changed: 20 additions & 0 deletions

‎.github/workflows/github-actions-cron-update-OR.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
# Allows you to run this workflow manually from the Actions tab
66
workflow_dispatch:
77

8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
issues: write
12+
813
jobs:
914
update:
1015
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}

‎.github/workflows/github-actions-cron-update-yosys.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
# Allows you to run this workflow manually from the Actions tab
77
workflow_dispatch:
88

9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
913
jobs:
1014
update:
1115
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}

‎.github/workflows/github-actions-manual-update-rules.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
required: true
88
default: 'normal'
99

10+
permissions:
11+
contents: write
12+
1013
jobs:
1114
update:
1215
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}

‎.github/workflows/github-actions-publish-docker-images.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
- tools/codespace/scripts/**
2626
- tools/codespace/Dockerfile-lxqt
2727

28+
permissions:
29+
contents: read
30+
packages: write
31+
2832
jobs:
2933
buildCodespaceImage:
3034
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}

‎.github/workflows/github-actions-update-rules.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
types:
55
- set-new-golden
66

7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
711
jobs:
812
update:
913
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}

0 commit comments

Comments
 (0)