Skip to content

Commit 194a4b5

Browse files
committed
ci: scope per-job permissions on the remaining workflows
Add explicit per-job `permissions:` blocks to the 4 workflows that were still relying on the repository default token permissions: `check.yml`, `emulate.yml`, `example-app.yml`, `features.yml`. - `check.yml`, `emulate.yml`, `example-app.yml` each have a single job that only needs to read source and run Gradle. They get `permissions: contents: read`. - `features.yml` invokes a reusable workflow at `ably/features/.github/workflows/sdk-features.yml`. Permissions for a reusable workflow are inherited from the calling job — the called workflow's own `permissions:` block cannot upgrade scopes the caller has not granted. The called workflow at the pinned SHA runs `actions/checkout`, then `aws-actions/configure-aws-credentials` (AWS OIDC), then `ably/sdk-upload-action` (creates a GitHub deployment). It therefore needs: permissions: contents: read id-token: write deployments: write These match the inline equivalent in `javadoc.yml`, which does the same upload work directly; `contents: read` is added here as an explicit tightening rather than relying on the public-repo default.
1 parent 2f70376 commit 194a4b5

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
jobs:
1111
check:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
1315
steps:
1416
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
1517
with:

.github/workflows/emulate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
check:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
1214
strategy:
1315
fail-fast: false
1416
matrix:

.github/workflows/example-app.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
check:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
1214
strategy:
1315
fail-fast: false
1416
matrix:

.github/workflows/features.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88

99
jobs:
1010
build:
11+
permissions:
12+
contents: read
13+
id-token: write
14+
deployments: write
1115
uses: ably/features/.github/workflows/sdk-features.yml@6b3fc7a8ede2ebdd7a6325314f3a96c6466f1453 # main
1216
with:
1317
repository-name: ably-java

0 commit comments

Comments
 (0)