Skip to content

Commit 7579682

Browse files
authored
Merge pull request #678 from ably/worktree-fixup-workflow
ci: GitHub Actions workflow security cleanup
2 parents 00b2ee6 + b2063da commit 7579682

4 files changed

Lines changed: 36 additions & 25 deletions

File tree

.github/workflows/check.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,34 @@ on:
1111
branches:
1212
- main
1313

14+
permissions: {}
15+
1416
jobs:
1517
check:
16-
18+
permissions:
19+
contents: read
1720
runs-on: ubuntu-22.04
1821
strategy:
1922
fail-fast: false
2023
matrix:
2124
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
2225
steps:
23-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2427
with:
2528
submodules: 'recursive'
29+
persist-credentials: false
2630
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2832
id: setup-python
2933
with:
3034
python-version: ${{ matrix.python-version }}
3135

3236
- name: Install uv
33-
uses: astral-sh/setup-uv@v7
37+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
3438
with:
3539
enable-cache: true
3640

37-
- uses: actions/cache@v4
41+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
3842
name: Define a cache for the virtual environment based on the dependencies lock file
3943
id: cache
4044
with:

.github/workflows/features.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ on:
66
branches:
77
- main
88

9+
permissions: {}
10+
911
jobs:
1012
build:
13+
permissions:
14+
contents: read
1115
uses: ably/features/.github/workflows/sdk-features.yml@main
1216
with:
1317
repository-name: ably-python

.github/workflows/lint.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,30 @@ on:
66
branches:
77
- main
88

9+
permissions: {}
10+
911
jobs:
1012
lint:
13+
permissions:
14+
contents: read
1115
runs-on: ubuntu-latest
1216
steps:
13-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1418
with:
1519
submodules: 'recursive'
20+
persist-credentials: false
1621
- name: Set up Python 3.9
17-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
1823
id: setup-python
1924
with:
2025
python-version: '3.9'
2126

2227
- name: Install uv
23-
uses: astral-sh/setup-uv@v7
28+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2429
with:
2530
enable-cache: true
2631

27-
- uses: actions/cache@v4
32+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2833
name: Define a cache for the virtual environment based on the dependencies lock file
2934
id: cache
3035
with:

.github/workflows/release.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,30 @@ on:
66
tags:
77
- 'v[0-9]+.[0-9]+.[0-9]+*'
88

9+
permissions: {}
10+
911
jobs:
1012
build:
1113
name: Build distribution 📦
1214
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
1317

1418
steps:
15-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1620
with:
1721
submodules: 'recursive'
22+
persist-credentials: false
1823
- name: Set up Python 3.12
19-
uses: actions/setup-python@v5
24+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2025
id: setup-python
2126
with:
2227
python-version: 3.12
2328

2429
- name: Install uv
25-
uses: astral-sh/setup-uv@v7
26-
with:
27-
enable-cache: true
28-
29-
- uses: actions/cache@v4
30-
name: Define a cache for the virtual environment based on the dependencies lock file
31-
id: cache
30+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
3231
with:
33-
path: ./.venv
34-
key: venv-${{ runner.os }}-3.12-${{ hashFiles('uv.lock') }}
32+
enable-cache: false
3533

3634
- name: Install dependencies
3735
run: uv sync --extra crypto --extra dev
@@ -40,7 +38,7 @@ jobs:
4038
- name: Build a binary wheel and a source tarball
4139
run: uv build
4240
- name: Store the distribution packages
43-
uses: actions/upload-artifact@v4
41+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
4442
with:
4543
name: python-package-distributions
4644
path: dist/
@@ -82,7 +80,7 @@ jobs:
8280

8381
steps:
8482
- name: Download all the dists
85-
uses: actions/download-artifact@v4
83+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
8684
with:
8785
name: python-package-distributions
8886
path: dist/
@@ -110,7 +108,7 @@ jobs:
110108
TAG: ${{ steps.tag.outputs.tag }}
111109

112110
- name: Publish distribution 📦 to PyPI
113-
uses: pypa/gh-action-pypi-publish@release/v1
111+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
114112

115113
publish-to-testpypi:
116114
name: Publish Python distribution to TestPyPI
@@ -127,11 +125,11 @@ jobs:
127125

128126
steps:
129127
- name: Download all the dists
130-
uses: actions/download-artifact@v4
128+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
131129
with:
132130
name: python-package-distributions
133131
path: dist/
134132
- name: Publish distribution 📦 to TestPyPI
135-
uses: pypa/gh-action-pypi-publish@release/v1
133+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
136134
with:
137135
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)