Skip to content

Commit c2abd05

Browse files
ci: harden github actions according to "zizmor" recommendations (#13062) (#13067)
Fix all issues reported by zizmor 0.9.2 running locally. See: https://woodruffw.github.io/zizmor/ (cherry picked from commit ee8f98d) Co-authored-by: Ran Benita <[email protected]>
1 parent ebd23c1 commit c2abd05

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.github/workflows/deploy.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
contents: write
4747
steps:
4848
- uses: actions/checkout@v4
49+
with:
50+
persist-credentials: true
4951

5052
- name: Download Package
5153
uses: actions/download-artifact@v4
@@ -59,11 +61,13 @@ jobs:
5961
attestations: true
6062

6163
- name: Push tag
64+
env:
65+
VERSION: ${{ github.event.inputs.version }}
6266
run: |
6367
git config user.name "pytest bot"
6468
git config user.email "[email protected]"
65-
git tag --annotate --message=v${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }}
66-
git push origin ${{ github.event.inputs.version }}
69+
git tag --annotate --message=v"$VERSION" "$VERSION" ${{ github.sha }}
70+
git push origin "$VERSION"
6771
6872
release-notes:
6973

@@ -98,9 +102,11 @@ jobs:
98102
pip install --upgrade tox
99103
100104
- name: Generate release notes
105+
env:
106+
VERSION: ${{ github.event.inputs.version }}
101107
run: |
102108
sudo apt-get install pandoc
103-
tox -e generate-gh-release-notes -- ${{ github.event.inputs.version }} scripts/latest-release-notes.md
109+
tox -e generate-gh-release-notes -- "$VERSION" scripts/latest-release-notes.md
104110
105111
- name: Publish GitHub Release
106112
uses: softprops/action-gh-release@v2

.github/workflows/prepare-release-pr.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
with:
3232
fetch-depth: 0
33+
persist-credentials: false
3334

3435
- name: Set up Python
3536
uses: actions/setup-python@v5
@@ -43,10 +44,16 @@ jobs:
4344
4445
- name: Prepare release PR (minor/patch release)
4546
if: github.event.inputs.major == 'no'
47+
env:
48+
BRANCH: ${{ github.event.inputs.branch }}
49+
PRERELEASE: ${{ github.event.inputs.prerelease }}
4650
run: |
47-
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease='${{ github.event.inputs.prerelease }}'
51+
tox -e prepare-release-pr -- "$BRANCH" ${{ github.token }} --prerelease="$PRERELEASE"
4852
4953
- name: Prepare release PR (major release)
5054
if: github.event.inputs.major == 'yes'
55+
env:
56+
BRANCH: ${{ github.event.inputs.branch }}
57+
PRERELEASE: ${{ github.event.inputs.prerelease }}
5158
run: |
52-
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease='${{ github.event.inputs.prerelease }}'
59+
tox -e prepare-release-pr -- "$BRANCH" ${{ github.token }} --major --prerelease="$PRERELEASE"

.github/workflows/update-plugin-list.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ jobs:
2323
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
26+
persist-credentials: false
2627

2728
- name: Setup Python
2829
uses: actions/setup-python@v5
2930
with:
3031
python-version: "3.11"
3132
cache: pip
33+
3234
- name: requests-cache
3335
uses: actions/cache@v4
3436
with:
@@ -41,7 +43,6 @@ jobs:
4143
python -m pip install --upgrade pip
4244
pip install packaging requests tabulate[widechars] tqdm requests-cache platformdirs
4345
44-
4546
- name: Update Plugin List
4647
run: python scripts/update-plugin-list.py
4748

@@ -61,8 +62,9 @@ jobs:
6162
- name: Instruct the maintainers to trigger CI by undrafting the PR
6263
env:
6364
GITHUB_TOKEN: ${{ github.token }}
65+
PULL_REQUEST_NUMBER: ${{ steps.pr.outputs.pull-request-number }}
6466
run: >-
6567
gh pr comment
6668
--body 'Please mark the PR as ready for review to trigger PR checks.'
6769
--repo '${{ github.repository }}'
68-
'${{ steps.pr.outputs.pull-request-number }}'
70+
"$PULL_REQUEST_NUMBER"

0 commit comments

Comments
 (0)