Skip to content

Commit 2572f07

Browse files
committed
Merge branch 'main' into copilot/add-gha-check-branch-alias
2 parents 9d4a9b2 + 22cfd29 commit 2572f07

File tree

7 files changed

+227
-16
lines changed

7 files changed

+227
-16
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v6
21+
22+
- name: Check existence of composer.json file
23+
id: check_composer_file
24+
uses: andstor/file-existence-action@v3
25+
with:
26+
files: "composer.json"
27+
28+
- name: Set up PHP environment
29+
if: steps.check_composer_file.outputs.files_exists == 'true'
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: 'latest'
33+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
34+
coverage: 'none'
35+
tools: composer,cs2pr
36+
env:
37+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Install Composer dependencies & cache dependencies
40+
if: steps.check_composer_file.outputs.files_exists == 'true'
41+
uses: ramsey/composer-install@v3
42+
env:
43+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
44+
with:
45+
# Bust the cache at least once a month - output format: YYYY-MM.
46+
custom-cache-suffix: $(date -u "+%Y-%m")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Manage Labels
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
paths:
11+
- 'composer.json'
12+
13+
permissions:
14+
issues: write
15+
contents: read
16+
17+
jobs:
18+
manage-labels:
19+
uses: wp-cli/.github/.github/workflows/reusable-manage-labels.yml@main

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Check out source code
25-
uses: actions/checkout@v5
25+
uses: actions/checkout@v6
2626

2727
- name: Add problem matcher
2828
run: |
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: Check out source code
42-
uses: actions/checkout@v5
42+
uses: actions/checkout@v6
4343

4444
- name: Check existence of composer.json file
4545
id: check_composer_file
@@ -100,7 +100,7 @@ jobs:
100100
runs-on: ubuntu-latest
101101
steps:
102102
- name: Check out source code
103-
uses: actions/checkout@v5
103+
uses: actions/checkout@v6
104104

105105
- name: Setup node
106106
uses: actions/setup-node@v6
@@ -116,7 +116,7 @@ jobs:
116116
runs-on: ubuntu-latest
117117
steps:
118118
- name: Check out source code
119-
uses: actions/checkout@v5
119+
uses: actions/checkout@v6
120120

121121
- name: Check existence of config file
122122
id: check_files
@@ -126,15 +126,15 @@ jobs:
126126

127127
- name: Check spelling
128128
if: steps.check_files.outputs.files_exists == 'true'
129-
uses: crate-ci/typos@v1.39.0
129+
uses: crate-ci/typos@v1.40.0
130130

131131
phpcs: #----------------------------------------------------------------------
132132
name: PHPCS
133133
runs-on: ubuntu-latest
134134

135135
steps:
136136
- name: Check out source code
137-
uses: actions/checkout@v5
137+
uses: actions/checkout@v6
138138

139139
- name: Check existence of composer.json & phpcs.xml.dist files
140140
id: check_files
@@ -183,7 +183,7 @@ jobs:
183183

184184
steps:
185185
- name: Check out source code
186-
uses: actions/checkout@v5
186+
uses: actions/checkout@v6
187187

188188
- name: Check existence of composer.json & phpcs.xml.dist files
189189
id: check_files
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
name: Manage Repository Labels
3+
4+
'on':
5+
workflow_call:
6+
7+
permissions:
8+
issues: write
9+
contents: read
10+
11+
jobs:
12+
manage-labels:
13+
name: Create/Update Repository Labels
14+
runs-on: ubuntu-latest
15+
if: ${{ github.repository_owner == 'wp-cli' }}
16+
steps:
17+
- name: Check out source code
18+
uses: actions/checkout@v5
19+
20+
- name: Set up PHP environment
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: 'latest'
24+
env:
25+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Check existence of composer.json file
28+
id: check_composer_file
29+
uses: andstor/file-existence-action@v3
30+
with:
31+
files: "composer.json"
32+
33+
- name: Get commands from composer.json
34+
id: get-commands
35+
if: steps.check_composer_file.outputs.files_exists == 'true'
36+
run: |
37+
# Extract commands from composer.json using composer config
38+
COMMANDS=$(composer config extra.commands 2>/dev/null || echo "[]")
39+
echo "commands=${COMMANDS}" >> "$GITHUB_OUTPUT"
40+
echo "Commands found: ${COMMANDS}"
41+
42+
- name: Create/Update labels
43+
uses: actions/github-script@v7
44+
env:
45+
COMMANDS_JSON: ${{ steps.get-commands.outputs.commands }}
46+
with:
47+
script: |
48+
// Standard labels that should exist in every repository
49+
const standardLabels = [
50+
{ name: 'good-first-issue', color: '7057ff', description: 'Good for newcomers' },
51+
{ name: 'help-wanted', color: '008672', description: 'Extra attention is needed' },
52+
{ name: 'scope:documentation', color: 'FEF2C0', description: 'Related to documentation' },
53+
{ name: 'scope:testing', color: 'FEF2C0', description: 'Related to testing' },
54+
{ name: 'scope:distribution', color: '5B7E7E', description: 'Related to distribution' },
55+
{ name: 'status:unconfirmed', color: 'BFE5BF', description: 'Issue was could not be confirmed yet' },
56+
{ name: 'status:unsupported', color: 'BFE5BF', description: 'Ask is not supported' }
57+
];
58+
59+
// Parse commands from composer.json
60+
const commandsEnv = process.env.COMMANDS_JSON || '[]';
61+
let commands = [];
62+
63+
try {
64+
commands = JSON.parse(commandsEnv);
65+
if (!Array.isArray(commands)) {
66+
commands = [];
67+
}
68+
} catch (e) {
69+
console.log('No commands found or invalid JSON format');
70+
commands = [];
71+
}
72+
73+
// Generate command-specific labels
74+
const commandLabels = commands.map(command => {
75+
// Convert command to label format: replace spaces with dashes
76+
const labelName = 'command:' + command.replace(/\s+/g, '-');
77+
return {
78+
name: labelName,
79+
color: 'C5DEF5',
80+
description: `Related to '${command}' command`
81+
};
82+
});
83+
84+
// Combine all labels
85+
const allLabels = [...standardLabels, ...commandLabels];
86+
87+
console.log(`Creating/updating ${allLabels.length} labels...`);
88+
89+
// Create or update each label
90+
for (const label of allLabels) {
91+
try {
92+
// Try to get existing label
93+
try {
94+
await github.rest.issues.getLabel({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
name: label.name
98+
});
99+
100+
// Update if it exists
101+
await github.rest.issues.updateLabel({
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
name: label.name,
105+
color: label.color,
106+
description: label.description
107+
});
108+
console.log(`✓ Updated label: ${label.name}`);
109+
} catch (error) {
110+
if (error.status === 404) {
111+
// Create if it doesn't exist
112+
await github.rest.issues.createLabel({
113+
owner: context.repo.owner,
114+
repo: context.repo.repo,
115+
name: label.name,
116+
color: label.color,
117+
description: label.description
118+
});
119+
console.log(`✓ Created label: ${label.name}`);
120+
} else {
121+
throw error;
122+
}
123+
}
124+
} catch (error) {
125+
console.error(`✗ Failed to process label '${label.name}': ${error.message}`);
126+
}
127+
}
128+
129+
console.log('Label management complete!');

.github/workflows/reusable-regenerate-readme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: ${{ github.repository_owner == 'wp-cli' && ! contains(fromJson('[".github", "wp-cli", "wp-cli-bundle", "wp-super-cache-cli", "php-cli-tools", "wp-config-transformer", "wp-cli.github.com"]'), github.event.repository.name) }}
1919
steps:
2020
- name: Check out source code
21-
uses: actions/checkout@v5
21+
uses: actions/checkout@v6
2222

2323
- name: Set up PHP environment
2424
uses: shivammathur/setup-php@v2

.github/workflows/reusable-testing.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ jobs:
198198
"wp": "trunk",
199199
"dbtype": "sqlite"
200200
},
201+
{
202+
"php": "8.5",
203+
"wp": "trunk",
204+
"mysql": "mysql-8.0"
205+
},
206+
{
207+
"php": "8.5",
208+
"wp": "trunk",
209+
"dbtype": "sqlite"
210+
},
201211
{
202212
"php": "nightly",
203213
"wp": "trunk",
@@ -223,7 +233,7 @@ jobs:
223233
matrix: ${{ steps.set-matrix.outputs.matrix }}
224234
steps:
225235
- name: Check out source code
226-
uses: actions/checkout@v5
236+
uses: actions/checkout@v6
227237

228238
- name: Check existence of composer.json & phpunit.xml.dist files
229239
id: check_files
@@ -280,7 +290,7 @@ jobs:
280290

281291
steps:
282292
- name: Check out source code
283-
uses: actions/checkout@v5
293+
uses: actions/checkout@v6
284294

285295
- name: Set up PHP environment
286296
uses: shivammathur/setup-php@v2
@@ -325,7 +335,7 @@ jobs:
325335
326336
- name: Upload code coverage report
327337
if: ${{ matrix.coverage }}
328-
uses: codecov/codecov-action@v5.5.1
338+
uses: codecov/codecov-action@v5.5.2
329339
with:
330340
directory: build/logs
331341
flags: unit
@@ -339,7 +349,7 @@ jobs:
339349
matrix: ${{ steps.set-matrix.outputs.matrix }}
340350
steps:
341351
- name: Check out source code
342-
uses: actions/checkout@v5
352+
uses: actions/checkout@v6
343353

344354
- name: Check existence of composer.json & behat.yml files
345355
id: check_files
@@ -410,7 +420,7 @@ jobs:
410420

411421
steps:
412422
- name: Check out source code
413-
uses: actions/checkout@v5
423+
uses: actions/checkout@v6
414424

415425
- name: Install Ghostscript
416426
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == '' }}
@@ -473,7 +483,7 @@ jobs:
473483
WP_CLI_TEST_DBTYPE: ${{ matrix.dbtype || 'mysql' }}
474484
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
475485
WP_CLI_TEST_COVERAGE: ${{ matrix.coverage }}
476-
BEHAT_ARGS: ${{ format( '{0} {1}', matrix.coverage && '--xdebug', runner.debug && '--format-pretty' ) }}
486+
BEHAT_ARGS: ${{ format( '{0}', runner.debug && '--format-pretty' ) }}
477487
run: |
478488
composer behat -- $BEHAT_ARGS || composer behat-rerun -- $BEHAT_ARGS
479489
@@ -486,7 +496,7 @@ jobs:
486496
487497
- name: Upload code coverage report
488498
if: ${{ matrix.coverage }}
489-
uses: codecov/codecov-action@v5.5.1
499+
uses: codecov/codecov-action@v5.5.2
490500
with:
491501
# Because somehow providing `directory: build/logs` doesn't work for these files
492502
files: ${{ steps.coverage_files.outputs.files }}

.github/workflows/sync-workflows.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ jobs:
2222
FILE_PATTERNS: |
2323
^.actrc
2424
^.editorconfig
25-
^.github/workflows/code-quality.yml
25+
^.github/workflows/copilot-setup-steps.yml
2626
^.github/workflows/regenerate-readme.yml
2727
^.github/workflows/check-branch-alias.yml
28+
^.github/workflows/manage-labels.yml
2829
^AGENTS.md
2930
TARGET_REPOS: |
31+
wp-cli/ability-command
3032
wp-cli/admin-command
33+
wp-cli/block-command
3134
wp-cli/cache-command
3235
wp-cli/checksum-command
3336
wp-cli/config-command
@@ -80,7 +83,10 @@ jobs:
8083
FILE_PATTERNS: |
8184
^.github/dependabot.yml
8285
TARGET_REPOS: |
86+
wp-cli/ability-command
8387
wp-cli/admin-command
88+
wp-cli/automated-tests
89+
wp-cli/block-command
8490
wp-cli/cache-command
8591
wp-cli/checksum-command
8692
wp-cli/config-command
@@ -96,6 +102,7 @@ jobs:
96102
wp-cli/extension-command
97103
wp-cli/find-command
98104
wp-cli/google-sitemap-generator-cli
105+
wp-cli/handbook
99106
wp-cli/i18n-command
100107
wp-cli/import-command
101108
wp-cli/language-command

0 commit comments

Comments
 (0)