Skip to content

Commit 2ff4e18

Browse files
committed
Harden existing workflows to pass zizmor (pedantic)
Pin actions to commit SHAs (latest releases), add concurrency limits, and set persist-credentials: false on read-only checkouts.
1 parent fe416cc commit 2ff4e18

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ env:
1010
permissions:
1111
contents: read
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
tests:
1519
name: "CI"
@@ -35,17 +39,19 @@ jobs:
3539
- "8.4"
3640

3741
steps:
38-
- uses: actions/checkout@v6
42+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+
with:
44+
persist-credentials: false
3945

40-
- uses: shivammathur/setup-php@v2
46+
- uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
4147
with:
4248
php-version: "${{ matrix.php-version }}"
4349
coverage: none
4450

4551
- name: "Remove PHPStan as it requires a newer PHP"
4652
run: composer remove phpstan/phpstan --dev --no-update
4753

48-
- uses: ramsey/composer-install@v4
54+
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
4955
with:
5056
dependency-versions: highest
5157

.github/workflows/lint.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
permissions:
88
contents: read
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
tests:
1216
name: "Lint"
@@ -21,9 +25,11 @@ jobs:
2125
- "nightly"
2226

2327
steps:
24-
- uses: actions/checkout@v6
28+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
persist-credentials: false
2531

26-
- uses: shivammathur/setup-php@v2
32+
- uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
2733
with:
2834
php-version: "${{ matrix.php-version }}"
2935
coverage: none

.github/workflows/phpstan.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
permissions:
88
contents: read
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
tests:
1216
name: "PHPStan"
@@ -22,18 +26,22 @@ jobs:
2226
phpunit-version-constraint: "^9.6"
2327

2428
steps:
25-
- uses: actions/checkout@v6
29+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
with:
31+
persist-credentials: false
2632

27-
- uses: shivammathur/setup-php@v2
33+
- uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
2834
with:
2935
php-version: "${{ matrix.php-version }}"
3036
coverage: none
3137

32-
- uses: ramsey/composer-install@v4
38+
- uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
3339
with:
3440
dependency-versions: highest
3541

3642
- name: Run PHPStan
43+
env:
44+
PHPUNIT_VERSION_CONSTRAINT: ${{ matrix.phpunit-version-constraint }}
3745
run: |
38-
composer require --dev phpunit/phpunit:"${{ matrix.phpunit-version-constraint }}" --with-all-dependencies -n
46+
composer require --dev phpunit/phpunit:"$PHPUNIT_VERSION_CONSTRAINT" --with-all-dependencies -n
3947
vendor/bin/phpstan analyse

0 commit comments

Comments
 (0)