Skip to content

Commit bb49389

Browse files
🪲 [Fix]: Obsolete GitHub token write permissions removed (#521)
Repositories that use the GitHub App permission model can run Process-PSModule without granting unneeded repository, pull-request, or status write access. GitHub Pages deployments continue to use the caller's `github.token` with `contents: read`, `pages: write`, and `id-token: write`. ## Fixed: Reusable workflow permission escalation The reusable workflow no longer requests permissions that GitHub App installation tokens already provide for release and pull-request operations. Update caller workflows to use the narrowed permission block documented for `v8`. ```yaml permissions: contents: read pages: write id-token: write ``` --- <details> <summary>Technical details</summary> - Removed legacy `github.token` write requests from the reusable workflow and nested jobs; scoped GitHub App tokens retain repository and pull-request write access. - Updated repository workflow tests and caller documentation to use the `v8` permission contract. | Changed surface | Standards checked | Framework docs checked | Result | | --- | --- | --- | --- | | `.github/workflows/**` | GitHub Actions | Reusable workflow contract | Fixed in this PR | | `docs/content/**` | Markdown, Natural Language | Workflow setup guides | Fixed in this PR | </details> <details> <summary>Relevant issues (or links)</summary> ### Related work - References #510 </details> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 8414050 commit bb49389

11 files changed

Lines changed: 18 additions & 35 deletions

.github/workflows/Build-Docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010

1111
permissions:
1212
contents: read # to checkout the repo
13-
statuses: write # to create commit status
1413

1514
jobs:
1615
Build-Docs:

.github/workflows/Lint-Repository.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ on:
99
required: true
1010

1111
permissions:
12-
contents: read # to checkout the repository
13-
statuses: write # to update the status of the workflow from linter
14-
pull-requests: write # to post super-linter summary comments on PRs
12+
contents: read # to checkout the repository
1513

1614
jobs:
1715
Lint-Repository:

.github/workflows/Plan.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ on:
6464

6565
permissions:
6666
contents: read # to checkout the repo
67-
pull-requests: write # to add labels / comments to PRs
6867

6968
jobs:
7069
Plan:

.github/workflows/Publish-Module.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
name: Publish-Module
2626
runs-on: ubuntu-24.04
2727
permissions:
28-
contents: write # Create releases and upload release artifacts.
29-
pull-requests: write # Comment on pull requests.
28+
contents: read # Checkout uses github.token.
3029
env:
3130
SETTINGS: ${{ inputs.Settings }}
3231
steps:

.github/workflows/Workflow-Test-Default.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ concurrency:
3535
cancel-in-progress: false
3636

3737
permissions:
38-
contents: write
39-
pull-requests: write
40-
statuses: write
38+
contents: read
4139
pages: write
4240
id-token: write
4341

.github/workflows/Workflow-Test-WithManifest.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ concurrency:
3535
cancel-in-progress: false
3636

3737
permissions:
38-
contents: write
39-
pull-requests: write
40-
statuses: write
38+
contents: read
4139
pages: write
4240
id-token: write
4341

.github/workflows/workflow.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ on:
6969
^README\.md$
7070
7171
permissions:
72-
contents: write # to checkout the repo and create releases on the repo
73-
pull-requests: write # to write comments to PRs
74-
statuses: write # to update the status of the workflow from linter
72+
contents: read # to checkout the repo
7573
pages: write # to deploy to Pages
7674
id-token: write # to verify the deployment originates from an appropriate source
7775

docs/content/get-started/repository-setup.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,20 @@ concurrency:
5757
cancel-in-progress: false
5858

5959
permissions:
60-
contents: write
61-
pull-requests: write
62-
statuses: write
60+
contents: read
6361
pages: write
6462
id-token: write
6563

6664
jobs:
6765
Process-PSModule:
68-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
66+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
6967
secrets:
7068
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
7169
GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }}
7270
GitHubAppPrivateKey: ${{ secrets.SHELLY_PRIVATE_KEY }}
7371
```
7472
75-
Every permission in that block is required. A push to `main` publishes a stable release after the full pipeline passes;
73+
Every permission in that block is required. GitHub App installation tokens perform repository writes. A push to `main` publishes a stable release after the full pipeline passes;
7674
the pull-request trigger handles CI, prereleases, and prerelease cleanup. See
7775
[Workflow inputs](../reference/workflow-inputs.md) for what each permission is used for, and
7876
[Calling the workflow](../guides/calling-the-workflow.md) for passing test secrets and variables.

docs/content/guides/calling-the-workflow.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ concurrency:
4040
cancel-in-progress: false
4141

4242
permissions:
43-
contents: write
44-
pull-requests: write
45-
statuses: write
43+
contents: read
4644
pages: write
4745
id-token: write
4846

4947
jobs:
5048
Process-PSModule:
51-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
49+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
5250
secrets:
5351
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
5452
GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }}
@@ -94,7 +92,7 @@ changes:
9492
```yaml
9593
jobs:
9694
Process-PSModule:
97-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
95+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
9896
secrets:
9997
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
10098
GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }}
@@ -123,7 +121,7 @@ content lines stay at the same indentation level:
123121
```yaml
124122
jobs:
125123
Process-PSModule:
126-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
124+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
127125
secrets:
128126
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
129127
GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }}
@@ -235,7 +233,7 @@ You can also pass patterns via the workflow input:
235233
```yaml
236234
jobs:
237235
Process:
238-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
236+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
239237
with:
240238
ImportantFilePatterns: |
241239
^src/
@@ -248,7 +246,7 @@ To disable triggering via the workflow input, pass an explicit empty string:
248246
```yaml
249247
jobs:
250248
process:
251-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
249+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
252250
with:
253251
ImportantFilePatterns: ''
254252
```

docs/content/guides/github-app-authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ names. Map the caller's secrets explicitly:
2323
```yaml
2424
jobs:
2525
Process-PSModule:
26-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
26+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8
2727
secrets:
2828
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
2929
GitHubAppClientId: ${{ secrets.SHELLY_CLIENT_ID }}

0 commit comments

Comments
 (0)