Skip to content

Commit 08315f1

Browse files
committed
GitHub Actions: set minimal job token permissions
1 parent 7ca9a0e commit 08315f1

3 files changed

Lines changed: 35 additions & 22 deletions

File tree

.github/workflows/coveralls.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
name: LibraryOfCongress/tests-bagit-python
2+
permissions: {}
3+
24
on:
3-
workflow_dispatch:
5+
workflow_dispatch:
46
jobs:
5-
test:
6-
runs-on: ubuntu-16.04
7-
steps:
8-
- name: checkout
9-
uses: actions/checkout@v3.5.0
10-
- uses: actions/setup-python@v4.6.0
11-
with:
12-
python-version: "${{ matrix.python }}"
13-
- run: apt-get -y install gettext
14-
- run: pip install --upgrade pip
15-
- run: pip install coveralls coverage
16-
- run: coverage run --include=bagit.py setup.py test
17-
- run: coveralls
18-
if: "${{ success() }}"
19-
strategy:
20-
matrix:
21-
python:
22-
- '3.10'
7+
test:
8+
permissions:
9+
contents: read
10+
runs-on: ubuntu-16.04
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v3.5.0
14+
- uses: actions/setup-python@v4.6.0
15+
with:
16+
python-version: "${{ matrix.python }}"
17+
- run: apt-get -y install gettext
18+
- run: pip install --upgrade pip
19+
- run: pip install coveralls coverage
20+
- run: coverage run --include=bagit.py setup.py test
21+
- run: coveralls
22+
if: "${{ success() }}"
23+
strategy:
24+
matrix:
25+
python:
26+
- "3.10"

.github/workflows/pypi-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: "PyPI releases"
2+
permissions: {}
23

34
on: release
45

56
jobs:
67
build_sdist:
78
name: Build Python source distribution
9+
permissions:
10+
contents: read
811
runs-on: ubuntu-latest
912
steps:
1013
- uses: actions/checkout@v3
@@ -19,14 +22,14 @@ jobs:
1922
pypi-publish:
2023
name: Upload release to PyPI
2124
if: github.event_name == 'release' && github.event.action == 'published'
25+
permissions:
26+
id-token: write
2227
needs:
2328
- build_sdist
2429
runs-on: ubuntu-latest
2530
environment:
2631
name: pypi
2732
url: https://pypi.org/p/bagit
28-
permissions:
29-
id-token: write
3033
steps:
3134
- uses: actions/download-artifact@v4
3235
with:

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Test
2+
permissions: {}
23

34
on:
45
push:
@@ -8,6 +9,8 @@ on:
89

910
jobs:
1011
ruff: # https://docs.astral.sh/ruff
12+
permissions:
13+
contents: read
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v4
@@ -16,11 +19,14 @@ jobs:
1619

1720
test:
1821
needs: ruff
22+
permissions:
23+
contents: read
1924
runs-on: ubuntu-latest
2025
strategy:
2126
fail-fast: false
2227
matrix:
23-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
28+
python-version:
29+
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
2430
steps:
2531
- uses: actions/checkout@v4
2632
- name: Set up Python ${{ matrix.python-version }}

0 commit comments

Comments
 (0)