Skip to content

Commit e5ae51e

Browse files
committed
chore: add agentic action
1 parent 23a9833 commit e5ae51e

3 files changed

Lines changed: 120 additions & 3 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Agent Task"
2+
description: "Structured task for coding agents"
3+
labels: ["agent"]
4+
body:
5+
- type: textarea
6+
id: goal
7+
attributes:
8+
label: Goal / Acceptance Criteria
9+
description: "What does 'done' look like? Be specific."
10+
placeholder: "Example: Add a new customizer control to the dashboard app and ensure it renders on the frontend."
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: constraints
16+
attributes:
17+
label: Constraints / Do Not Touch
18+
description: "List files/areas to avoid or any guardrails."
19+
placeholder: "Example: Do not edit build outputs directly; do not change vendor/ or node_modules/."
20+
validations:
21+
required: false
22+
23+
- type: textarea
24+
id: relevant_files
25+
attributes:
26+
label: Relevant Files (if known)
27+
description: "Optional: point the agent to likely files."
28+
placeholder: "Example: assets/apps/dashboard/src/, inc/customizer/, AGENTS.md"
29+
validations:
30+
required: false
31+
32+
- type: textarea
33+
id: tests
34+
attributes:
35+
label: Tests to Run
36+
description: "Default is PHP lint/PHPStan/PHPUnit unless explicitly scoped out. Add the JS/E2E steps when those areas are touched."
37+
value: |
38+
Default:
39+
- composer run lint
40+
- composer run phpstan
41+
- phpunit
42+
43+
When JS/TS files are touched:
44+
- yarn run lint
45+
- yarn run build
46+
47+
When UI/E2E flows are touched:
48+
- yarn run test:playwright
49+
validations:
50+
required: true
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
# The job MUST be called `copilot-setup-steps` for the Copilot coding agent to pick it up.
14+
copilot-setup-steps:
15+
runs-on: ubuntu-22.04
16+
permissions:
17+
contents: read
18+
services:
19+
mysql:
20+
image: mysql:5.7
21+
env:
22+
MYSQL_ROOT_PASSWORD: root
23+
ports:
24+
- 3306/tcp
25+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
26+
27+
# These steps run before the agent starts, to pre-install dependencies and tools.
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "16"
36+
cache: "yarn"
37+
38+
- name: Install JavaScript dependencies
39+
run: yarn install --frozen-lockfile
40+
41+
- name: Install Playwright browsers
42+
run: npx playwright install --with-deps chromium
43+
44+
- name: Set up PHP
45+
uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: "7.4"
48+
extensions: simplexml, mysql
49+
tools: phpunit, phpunit-polyfills, wp-cli, phpcs, phpstan
50+
51+
- name: Install PHP dependencies
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
54+
run: COMPOSER=composer-dev.json composer install --prefer-dist --no-progress
55+
56+
- name: Build assets
57+
run: yarn run build
58+
59+
- name: Install WordPress Test Suite
60+
run: |
61+
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:${{ job.services.mysql.ports['3306'] }}

AGENTS.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ yarn run format:scss
4949
## Testing
5050

5151
```bash
52-
# PHP unit tests
53-
./vendor/bin/phpunit
54-
./vendor/bin/phpunit tests/test-neve.php # Single test file
52+
# PHP unit tests. Prerequisites: MySQL, the WordPress test suite, and the PHPUnit
53+
# Polyfills. Neither PHPUnit nor the Polyfills are composer deps here: GitHub-hosted
54+
# runners ship PHPUnit preinstalled globally, and setup-php adds the Polyfills
55+
# (tools: phpunit-polyfills). copilot-setup-steps.yml installs both. Install the suite once:
56+
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1
57+
# On macOS the suite installs under $TMPDIR; export WP_TESTS_DIR so PHPUnit finds it:
58+
# export WP_TESTS_DIR="$TMPDIR/wordpress-tests-lib"
59+
phpunit # phpunit is NOT a composer dep here; use the global one (CI/copilot-setup provide it)
60+
phpunit tests/test-neve.php # Single test file
5561

5662
# E2E tests (Playwright, requires WordPress environment)
5763
yarn run test:playwright

0 commit comments

Comments
 (0)