Skip to content

Commit f62c5cd

Browse files
committed
ci: scope pull-requests: read to the file-changes job
Granting pull-requests: read at the workflow level handed it to every job in these six files, including the multi-hour NVHPC container lanes and the self-hosted Frontier and Phoenix runs, none of which touch the PR API. Only file-changes needs it: it is the sole job running dorny/paths-filter, it finishes in about ten seconds, and it holds no other privilege. Move the grant there and return the workflow default to contents: read. Job-level permissions replace the workflow default outright rather than merging with it, so contents: read is restated alongside pull-requests: read in the job block; a bare pull-requests: read there would have revoked contents and broken the job's own checkout. Claude-Session: https://claude.ai/code/session_01XPqfEaUBG7ZaZVzeMWnKHd
1 parent 5f4be21 commit f62c5cd

6 files changed

Lines changed: 42 additions & 18 deletions

File tree

.github/workflows/bench.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
# Least-privilege default: no job in this workflow writes to the repo.
14-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
15-
# changed-file list through the API on pull_request events.
1614
permissions:
1715
contents: read
18-
pull-requests: read
1916

2017
jobs:
2118
file-changes:
2219
name: Detect File Changes
2320
if: >
2421
github.event_name != 'pull_request_review' ||
2522
github.event.review.user.type != 'Bot'
23+
# Job-level permissions replace the workflow default outright rather than
24+
# merging with it, so contents must be restated here. paths-filter reads the
25+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
26+
# it, so it is granted here instead of workflow-wide.
27+
permissions:
28+
contents: read
29+
pull-requests: read
2630
runs-on: 'ubuntu-latest'
2731
outputs:
2832
checkall: ${{ steps.changes.outputs.checkall }}

.github/workflows/cleanliness.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
# Least-privilege default: no job in this workflow writes to the repo.
14-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
15-
# changed-file list through the API on pull_request events.
1614
permissions:
1715
contents: read
18-
pull-requests: read
1916

2017
jobs:
2118
file-changes:
2219
name: Detect File Changes
20+
# Job-level permissions replace the workflow default outright rather than
21+
# merging with it, so contents must be restated here. paths-filter reads the
22+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
23+
# it, so it is granted here instead of workflow-wide.
24+
permissions:
25+
contents: read
26+
pull-requests: read
2327
runs-on: 'ubuntu-latest'
2428
outputs:
2529
checkall: ${{ steps.changes.outputs.checkall }}

.github/workflows/convergence.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ env:
1111
OMPI_MCA_rmaps_base_oversubscribe: 1
1212

1313
# Least-privilege default: no job in this workflow writes to the repo.
14-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
15-
# changed-file list through the API on pull_request events.
1614
permissions:
1715
contents: read
18-
pull-requests: read
1916

2017
jobs:
2118
file-changes:
2219
name: Detect File Changes
20+
# Job-level permissions replace the workflow default outright rather than
21+
# merging with it, so contents must be restated here. paths-filter reads the
22+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
23+
# it, so it is granted here instead of workflow-wide.
24+
permissions:
25+
contents: read
26+
pull-requests: read
2327
runs-on: ubuntu-latest
2428
outputs:
2529
checkall: ${{ steps.changes.outputs.checkall }}

.github/workflows/coverage.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
# Least-privilege default: no job in this workflow writes to the repo.
15-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
16-
# changed-file list through the API on pull_request events.
1715
permissions:
1816
contents: read
19-
pull-requests: read
2017

2118
jobs:
2219
file-changes:
2320
name: Detect File Changes
21+
# Job-level permissions replace the workflow default outright rather than
22+
# merging with it, so contents must be restated here. paths-filter reads the
23+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
24+
# it, so it is granted here instead of workflow-wide.
25+
permissions:
26+
contents: read
27+
pull-requests: read
2428
runs-on: 'ubuntu-latest'
2529
outputs:
2630
checkall: ${{ steps.changes.outputs.checkall }}

.github/workflows/fp-stability.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ on:
3636
workflow_dispatch:
3737

3838
# Least-privilege default: no job in this workflow writes to the repo.
39-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
40-
# changed-file list through the API on pull_request events.
4139
permissions:
4240
contents: read
43-
pull-requests: read
4441

4542
jobs:
4643
file-changes:
4744
name: Detect File Changes
45+
# Job-level permissions replace the workflow default outright rather than
46+
# merging with it, so contents must be restated here. paths-filter reads the
47+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
48+
# it, so it is granted here instead of workflow-wide.
49+
permissions:
50+
contents: read
51+
pull-requests: read
4852
runs-on: ubuntu-latest
4953
outputs:
5054
checkall: ${{ steps.changes.outputs.checkall }}

.github/workflows/test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ concurrency:
1313
cancel-in-progress: ${{ github.event_name != 'push' }}
1414

1515
# Least-privilege default: no job in this workflow writes to the repo.
16-
# pull-requests: read is required by dorny/paths-filter, which reads the PR's
17-
# changed-file list through the API on pull_request events.
1816
permissions:
1917
contents: read
20-
pull-requests: read
2118

2219
jobs:
2320
lint-gate:
@@ -57,6 +54,13 @@ jobs:
5754

5855
file-changes:
5956
name: Detect File Changes
57+
# Job-level permissions replace the workflow default outright rather than
58+
# merging with it, so contents must be restated here. paths-filter reads the
59+
# PR's changed-file list via pulls.listFiles; this is the only job that needs
60+
# it, so it is granted here instead of workflow-wide.
61+
permissions:
62+
contents: read
63+
pull-requests: read
6064
runs-on: 'ubuntu-latest'
6165
outputs:
6266
checkall: ${{ steps.changes.outputs.checkall }}

0 commit comments

Comments
 (0)