Skip to content

Commit abf8853

Browse files
CopilotswissspidyCopilot
authored
Add explicit permissions and remove decorator comments from workflows (#197)
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Pascal Birchler <pascalb@google.com>
1 parent fe38626 commit abf8853

14 files changed

+124
-84
lines changed

.github/workflows/code-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- main
99
- master
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
code-quality:
1316
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@main

.github/workflows/copilot-setup-steps.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file
24-
uses: andstor/file-existence-action@v3
24+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
2525
with:
2626
files: "composer.json"
2727

2828
- name: Set up PHP environment
2929
if: steps.check_composer_file.outputs.files_exists == 'true'
30-
uses: shivammathur/setup-php@v2
30+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
3131
with:
3232
php-version: 'latest'
3333
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Install Composer dependencies & cache dependencies
4040
if: steps.check_composer_file.outputs.files_exists == 'true'
41-
uses: ramsey/composer-install@v3
41+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3
4242
env:
4343
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
4444
with:

.github/workflows/issue-triage.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ name: Issue and PR Triage
1313
required: false
1414
type: string
1515

16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
actions: write
20+
contents: read
21+
models: read
22+
1623
jobs:
1724
issue-triage:
1825
uses: wp-cli/.github/.github/workflows/reusable-issue-triage.yml@main

.github/workflows/regenerate-readme.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- "features/**"
1111
- "README.md"
1212

13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
1317
jobs:
1418
regenerate-readme:
1519
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main

.github/workflows/reusable-check-branch-alias.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ jobs:
2727

2828
steps:
2929
- name: Check out source code
30-
uses: actions/checkout@v6
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
3131
with:
3232
fetch-depth: 0 # Fetch all history for all tags
3333
token: ${{ secrets.GITHUB_TOKEN }}
3434

3535
- name: Set up PHP
36-
uses: shivammathur/setup-php@v2
36+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
3737
with:
3838
php-version: 'latest'
3939
tools: composer
4040

4141
- name: Check existence of composer.json file
4242
id: check_composer_file
43-
uses: andstor/file-existence-action@v3
43+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
4444
with:
4545
files: "composer.json"
4646

@@ -126,7 +126,7 @@ jobs:
126126
127127
- name: Create Pull Request
128128
if: steps.check_alias.outputs.needs_update == 'true'
129-
uses: peter-evans/create-pull-request@v8
129+
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8
130130
with:
131131
token: ${{ secrets.GITHUB_TOKEN }}
132132
base: ${{ github.event.repository.default_branch }}

.github/workflows/reusable-code-quality.yml

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
required: false
1010
default: ''
1111

12+
permissions:
13+
contents: read
14+
1215
# Cancels all previous workflow runs for the same branch that have not yet completed.
1316
concurrency:
1417
# The concurrency group contains the workflow name and the branch name.
@@ -17,12 +20,12 @@ concurrency:
1720

1821
jobs:
1922

20-
actionlint: #-----------------------------------------------------------------------
23+
actionlint:
2124
name: Lint GitHub Actions workflows
2225
runs-on: ubuntu-latest
2326
steps:
2427
- name: Check out source code
25-
uses: actions/checkout@v6
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
2629

2730
- name: Add problem matcher
2831
run: |
@@ -34,22 +37,22 @@ jobs:
3437
with:
3538
args: -color -shellcheck=
3639

37-
lint: #-----------------------------------------------------------------------
40+
lint:
3841
name: Lint PHP files
3942
runs-on: ubuntu-latest
4043
steps:
4144
- name: Check out source code
42-
uses: actions/checkout@v6
45+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
4346

4447
- name: Check existence of composer.json file
4548
id: check_composer_file
46-
uses: andstor/file-existence-action@v3
49+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
4750
with:
4851
files: "composer.json"
4952

5053
- name: Set up PHP environment
5154
if: steps.check_composer_file.outputs.files_exists == 'true'
52-
uses: shivammathur/setup-php@v2
55+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
5356
with:
5457
php-version: 'latest'
5558
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -59,7 +62,7 @@ jobs:
5962

6063
- name: Install Composer dependencies & cache dependencies
6164
if: steps.check_composer_file.outputs.files_exists == 'true'
62-
uses: "ramsey/composer-install@v3"
65+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
6366
env:
6467
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
6568
with:
@@ -68,7 +71,7 @@ jobs:
6871

6972
- name: Check existence of vendor/bin/parallel-lint file
7073
id: check_linter_file
71-
uses: andstor/file-existence-action@v3
74+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
7275
with:
7376
files: "vendor/bin/parallel-lint"
7477

@@ -95,56 +98,56 @@ jobs:
9598
env:
9699
ADDITIONAL_EXCLUDES: ${{ inputs.parallel-lint-excludes }}
97100

98-
lint-gherkin: #----------------------------------------------------------------
101+
lint-gherkin:
99102
name: Lint Gherkin Feature files
100103
runs-on: ubuntu-latest
101104
steps:
102105
- name: Check out source code
103-
uses: actions/checkout@v6
106+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
104107

105108
- name: Setup node
106-
uses: actions/setup-node@v6
109+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
107110

108111
- name: Download lint rules
109112
run: curl https://raw.githubusercontent.com/wp-cli/.github/refs/heads/main/.gherkin-lintrc -o $RUNNER_TEMP/.gherkin-lintrc
110113

111114
- name: Run linter
112115
run: npx --yes gherkin-lint -c $RUNNER_TEMP/.gherkin-lintrc
113116

114-
lint-spellcheck: #----------------------------------------------------------------
117+
lint-spellcheck:
115118
name: Spell check
116119
runs-on: ubuntu-latest
117120
steps:
118121
- name: Check out source code
119-
uses: actions/checkout@v6
122+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
120123

121124
- name: Check existence of config file
122125
id: check_files
123-
uses: andstor/file-existence-action@v3
126+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
124127
with:
125128
files: ".typos.toml"
126129

127130
- name: Check spelling
128131
if: steps.check_files.outputs.files_exists == 'true'
129-
uses: crate-ci/typos@v1.42.1
132+
uses: crate-ci/typos@65120634e79d8374d1aa2f27e54baa0c364fff5a # v1.42.1
130133

131-
phpcs: #----------------------------------------------------------------------
134+
phpcs:
132135
name: PHPCS
133136
runs-on: ubuntu-latest
134137

135138
steps:
136139
- name: Check out source code
137-
uses: actions/checkout@v6
140+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
138141

139142
- name: Check existence of composer.json & phpcs.xml.dist files
140143
id: check_files
141-
uses: andstor/file-existence-action@v3
144+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
142145
with:
143146
files: "composer.json, phpcs.xml.dist"
144147

145148
- name: Set up PHP environment
146149
if: steps.check_files.outputs.files_exists == 'true'
147-
uses: shivammathur/setup-php@v2
150+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
148151
with:
149152
php-version: 'latest'
150153
tools: cs2pr
@@ -153,7 +156,7 @@ jobs:
153156

154157
- name: Install Composer dependencies & cache dependencies
155158
if: steps.check_files.outputs.files_exists == 'true'
156-
uses: "ramsey/composer-install@v3"
159+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
157160
env:
158161
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
159162
with:
@@ -162,7 +165,7 @@ jobs:
162165

163166
- name: Check existence of vendor/bin/phpcs file
164167
id: check_phpcs_binary_file
165-
uses: andstor/file-existence-action@v3
168+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
166169
with:
167170
files: "vendor/bin/phpcs"
168171

@@ -177,23 +180,23 @@ jobs:
177180
cs2pr /tmp/phpcs-checkstyle-report.xml
178181
fi
179182
180-
phpstan: #----------------------------------------------------------------------
183+
phpstan:
181184
name: PHPStan
182185
runs-on: ubuntu-latest
183186

184187
steps:
185188
- name: Check out source code
186-
uses: actions/checkout@v6
189+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
187190

188191
- name: Check existence of composer.json & phpcs.xml.dist files
189192
id: check_files
190-
uses: andstor/file-existence-action@v3
193+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
191194
with:
192195
files: "composer.json"
193196

194197
- name: Set up PHP environment
195198
if: steps.check_files.outputs.files_exists == 'true'
196-
uses: shivammathur/setup-php@v2
199+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
197200
with:
198201
php-version: 'latest'
199202
tools: cs2pr
@@ -202,7 +205,7 @@ jobs:
202205

203206
- name: Install Composer dependencies & cache dependencies
204207
if: steps.check_files.outputs.files_exists == 'true'
205-
uses: "ramsey/composer-install@v3"
208+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
206209
env:
207210
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
208211
with:
@@ -211,7 +214,7 @@ jobs:
211214

212215
- name: Check existence of vendor/bin/phpstan file
213216
id: check_phpstan_binary_file
214-
uses: andstor/file-existence-action@v3
217+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
215218
with:
216219
files: "vendor/bin/phpstan"
217220

.github/workflows/reusable-issue-triage.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- name: Get available labels
2626
id: get-labels
27-
uses: actions/github-script@v8
27+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
2828
with:
2929
script: |
3030
const labels = await github.rest.issues.listLabelsForRepo({
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: Analyze with AI
5555
id: ai-triage
56-
uses: actions/ai-inference@v2
56+
uses: actions/ai-inference@a6101c89c6feaecc585efdd8d461f18bb7896f20 # v2
5757
with:
5858
prompt: |
5959
## Role
@@ -105,7 +105,7 @@ jobs:
105105
106106
- name: Apply labels
107107
if: steps.ai-triage.outputs.response != ''
108-
uses: actions/github-script@v8
108+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
109109
env:
110110
AI_RESPONSE: ${{ steps.ai-triage.outputs.response }}
111111
AVAILABLE_LABELS: ${{ env.AVAILABLE_LABELS }}
@@ -174,7 +174,7 @@ jobs:
174174
runs-on: ubuntu-latest
175175
steps:
176176
- name: Find and dispatch triage for unlabeled items
177-
uses: actions/github-script@v8
177+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
178178
with:
179179
script: |
180180
// Get all open issues (includes PRs)
@@ -244,7 +244,7 @@ jobs:
244244
steps:
245245
- name: Get available labels
246246
id: get-labels
247-
uses: actions/github-script@v8
247+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
248248
with:
249249
script: |
250250
const labels = await github.rest.issues.listLabelsForRepo({
@@ -257,7 +257,7 @@ jobs:
257257
258258
- name: Get item details
259259
id: get-item
260-
uses: actions/github-script@v8
260+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
261261
with:
262262
script: |
263263
const itemNumber = parseInt('${{ inputs.issue_number }}');
@@ -295,7 +295,7 @@ jobs:
295295
296296
- name: Analyze with AI
297297
id: ai-triage
298-
uses: actions/ai-inference@v2
298+
uses: actions/ai-inference@a6101c89c6feaecc585efdd8d461f18bb7896f20 # v2
299299
with:
300300
prompt: |
301301
## Role
@@ -347,7 +347,7 @@ jobs:
347347
348348
- name: Apply labels
349349
if: steps.ai-triage.outputs.response != ''
350-
uses: actions/github-script@v8
350+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
351351
env:
352352
AI_RESPONSE: ${{ steps.ai-triage.outputs.response }}
353353
ITEM_NUMBER: ${{ inputs.issue_number }}

0 commit comments

Comments
 (0)