Skip to content

Commit 2afc75c

Browse files
committed
Revisit GitHub Actions
1 parent 59cc87b commit 2afc75c

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/netlicensing-publish-pypi.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ on:
1616
release:
1717
types: [published]
1818

19+
# Restrict the default GITHUB_TOKEN to read-only.
20+
# The publish job adds id-token: write for OIDC Trusted Publisher.
21+
permissions:
22+
contents: read
23+
1924
jobs:
2025
test:
2126
name: "Test before publish"
2227
runs-on: ubuntu-latest
28+
# inherits workflow-level permissions: contents: read
2329

2430
steps:
2531
- uses: actions/checkout@v4

.github/workflows/netlicensing-publish-testpypi.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ on:
2121
branches: [master]
2222
workflow_dispatch:
2323

24+
# Restrict the default GITHUB_TOKEN to read-only.
25+
# The publish job adds id-token: write for OIDC Trusted Publisher.
26+
permissions:
27+
contents: read
28+
2429
jobs:
2530
test:
2631
name: "Test before publish"
2732
runs-on: ubuntu-latest
33+
# inherits workflow-level permissions: contents: read
2834

2935
steps:
3036
- uses: actions/checkout@v4

.github/workflows/netlicensing-python-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
pull_request:
1010
branches: [master]
1111

12+
# Restrict the default GITHUB_TOKEN to read-only.
13+
# Individual jobs add back only the permissions they need.
14+
permissions:
15+
contents: read
16+
1217
jobs:
1318
test:
1419
name: "Test · Python ${{ matrix.python-version }}"

.github/workflows/netlicensing-python-dependency.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- cron: "0 6 * * 1" # every Monday at 06:00 UTC
1111
workflow_dispatch:
1212

13+
# Restrict the default GITHUB_TOKEN to read-only.
14+
permissions:
15+
contents: read
16+
1317
jobs:
1418
smoke-test:
1519
name: "Smoke test · Python ${{ matrix.python-version }}"

0 commit comments

Comments
 (0)