Skip to content

Commit 2f3942e

Browse files
justin808claude
andcommitted
Add PR comment command to trigger full CI suite
This adds a `/run-full-ci` command that can be used in PR comments to run the complete CI suite including tests normally skipped on PRs. **New workflows:** - `run-skipped-ci.yml` - Triggers on `/run-full-ci` comment, dispatches all CI workflows - `pr-welcome-comment.yml` - Auto-comments on new PRs explaining the command **Features:** - Runs full test matrix (all Ruby/Node versions) - Runs example generator tests - Runs Pro package integration and unit tests - Posts acknowledgment comment with workflow links - Adds rocket reaction to trigger comment **Documentation:** - Added `.github/README.md` with comprehensive docs - Explains why subset CI exists (fast feedback) - Documents testing limitations (must be on master branch) - Lists all available workflows and their purposes This improves the PR workflow by letting contributors easily run full CI on-demand without waiting for merge to master. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d1a8a1a commit 2f3942e

File tree

3 files changed

+257
-0
lines changed

3 files changed

+257
-0
lines changed

.github/README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# GitHub Actions CI/CD Configuration
2+
3+
This directory contains GitHub Actions workflows for continuous integration and deployment.
4+
5+
## PR Comment Commands
6+
7+
### `/run-full-ci` - Run Full CI Suite
8+
9+
When you open a PR, CI automatically runs a subset of tests for faster feedback (latest Ruby/Node versions only). To run the **complete CI suite** including all dependency combinations, add a comment to your PR:
10+
11+
```
12+
/run-full-ci
13+
```
14+
15+
This command will trigger:
16+
17+
- ✅ Main test suite with both latest and minimum supported versions
18+
- ✅ All example app generator tests
19+
- ✅ React on Rails Pro integration tests
20+
- ✅ React on Rails Pro package tests
21+
22+
The bot will:
23+
24+
1. React with a 🚀 to your comment
25+
2. Post a confirmation message with links to the triggered workflows
26+
3. Start all CI jobs on your PR branch
27+
28+
### Why This Exists
29+
30+
By default, PRs run a subset of CI jobs to provide fast feedback:
31+
32+
- Only latest dependency versions (Ruby 3.4, Node 22)
33+
- Skips example generator tests
34+
- Skips some Pro package tests
35+
36+
This is intentional to keep PR feedback loops fast. However, before merging, you should verify compatibility across all supported versions. The `/run-full-ci` command makes this easy without waiting for the PR to be merged to master.
37+
38+
## Testing Comment-Triggered Workflows
39+
40+
**Important**: Comment-triggered workflows (`issue_comment` event) only execute from the **default branch** (master). This creates a chicken-and-egg problem when developing workflow changes.
41+
42+
### Recommended Testing Approach
43+
44+
1. **Develop the workflow**: Create/modify the workflow in your feature branch
45+
2. **Test locally**: Validate YAML syntax and logic as much as possible
46+
3. **Merge to master**: The workflow must be in master to be triggered by comments
47+
4. **Test on a PR**: Create a test PR and use the comment command to verify
48+
49+
### Why This Limitation Exists
50+
51+
GitHub Actions workflows triggered by `issue_comment` events always use the workflow definition from the default branch, not the PR branch. This is a security feature to prevent malicious actors from modifying workflows through PRs.
52+
53+
For more details, see [GitHub's documentation on issue_comment events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment).
54+
55+
## Available Workflows
56+
57+
### CI Workflows (Triggered on Push/PR)
58+
59+
- **`main.yml`** - Main test suite (dummy app integration tests)
60+
- **`lint-js-and-ruby.yml`** - Linting for JavaScript and Ruby code
61+
- **`package-js-tests.yml`** - JavaScript unit tests for the package
62+
- **`rspec-package-specs.yml`** - RSpec tests for the Ruby package
63+
- **`examples.yml`** - Generator tests for example apps
64+
- **`playwright.yml`** - Playwright E2E tests
65+
- **`pro-integration-tests.yml`** - Pro package integration tests
66+
- **`pro-package-tests.yml`** - Pro package unit tests
67+
- **`pro-lint.yml`** - Pro package linting
68+
69+
### Utility Workflows
70+
71+
- **`run-full-ci.yml`** - Triggered by `/run-full-ci` comment on PRs
72+
- **`pr-welcome-comment.yml`** - Auto-comments on new PRs with helpful info
73+
- **`detect-changes.yml`** - Detects which parts of the codebase changed
74+
75+
### Code Review Workflows
76+
77+
- **`claude.yml`** - Claude AI code review
78+
- **`claude-code-review.yml`** - Additional Claude code review checks
79+
80+
### Other Workflows
81+
82+
- **`check-markdown-links.yml`** - Validates markdown links
83+
84+
## Workflow Permissions
85+
86+
Most workflows use minimal permissions. The comment-triggered workflows require:
87+
88+
- `contents: read` - To read the repository code
89+
- `pull-requests: write` - To post comments and reactions
90+
- `actions: write` - To trigger other workflows
91+
92+
## Conditional Execution
93+
94+
Many workflows use change detection to skip unnecessary jobs:
95+
96+
- Runs all jobs on pushes to `master`
97+
- Runs only relevant jobs on PRs based on changed files
98+
- Can be overridden with `workflow_dispatch` or `/run-full-ci` command
99+
100+
See `script/ci-changes-detector` for the change detection logic.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PR Welcome Comment
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
welcome:
9+
runs-on: ubuntu-22.04
10+
permissions:
11+
pull-requests: write
12+
steps:
13+
- name: Add welcome comment with CI command info
14+
uses: peter-evans/create-or-update-comment@v4
15+
with:
16+
issue-number: ${{ github.event.pull_request.number }}
17+
body: |
18+
👋 Thanks for opening this PR!
19+
20+
### 🚀 Running Full CI Suite
21+
22+
By default, PRs run a subset of CI jobs for faster feedback (latest Ruby/Node versions only).
23+
24+
To run the **complete CI suite** including all dependency combinations and skipped jobs, comment:
25+
26+
```
27+
/run-full-ci
28+
```
29+
30+
This will trigger:
31+
- ✅ Minimum supported versions (Ruby 3.2, Node 20)
32+
- ✅ All example app tests
33+
- ✅ Pro package integration tests
34+
- ✅ All test matrices
35+
36+
The full CI suite takes longer but ensures compatibility across all supported versions before merging.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Run Full CI Suite
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
trigger-full-ci:
9+
# Only run on PR comments that match the command
10+
if: |
11+
github.event.issue.pull_request &&
12+
contains(github.event.comment.body, '/run-full-ci')
13+
runs-on: ubuntu-22.04
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
actions: write
18+
steps:
19+
- name: Add reaction to comment
20+
uses: peter-evans/create-or-update-comment@v4
21+
with:
22+
comment-id: ${{ github.event.comment.id }}
23+
reactions: 'rocket'
24+
25+
- name: Get PR details
26+
id: pr
27+
uses: actions/github-script@v7
28+
with:
29+
script: |
30+
const pr = await github.rest.pulls.get({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
pull_number: context.issue.number
34+
});
35+
return {
36+
ref: pr.data.head.ref,
37+
sha: pr.data.head.sha
38+
};
39+
40+
- name: Post acknowledgment comment
41+
uses: peter-evans/create-or-update-comment@v4
42+
with:
43+
issue-number: ${{ github.event.issue.number }}
44+
body: |
45+
🚀 **Running full CI suite** on commit `${{ fromJSON(steps.pr.outputs.result).sha }}`
46+
47+
This will run all CI jobs including those normally skipped on PRs:
48+
- ✅ Minimum dependency versions (Ruby 3.2, Node 20)
49+
- ✅ All example app tests
50+
- ✅ Pro package integration tests
51+
- ✅ Pro package unit tests
52+
53+
View progress in the [Actions tab](${{ github.server_url }}/${{ github.repository }}/actions).
54+
55+
- name: Trigger main workflow
56+
uses: actions/github-script@v7
57+
with:
58+
script: |
59+
const prData = ${{ steps.pr.outputs.result }};
60+
try {
61+
await github.rest.actions.createWorkflowDispatch({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
workflow_id: 'main.yml',
65+
ref: prData.ref
66+
});
67+
console.log('✅ Triggered main.yml');
68+
} catch (error) {
69+
console.error('❌ Failed to trigger main.yml:', error.message);
70+
}
71+
72+
- name: Trigger examples workflow
73+
uses: actions/github-script@v7
74+
with:
75+
script: |
76+
const prData = ${{ steps.pr.outputs.result }};
77+
try {
78+
await github.rest.actions.createWorkflowDispatch({
79+
owner: context.repo.owner,
80+
repo: context.repo.repo,
81+
workflow_id: 'examples.yml',
82+
ref: prData.ref
83+
});
84+
console.log('✅ Triggered examples.yml');
85+
} catch (error) {
86+
console.error('❌ Failed to trigger examples.yml:', error.message);
87+
}
88+
89+
- name: Trigger Pro integration tests
90+
uses: actions/github-script@v7
91+
with:
92+
script: |
93+
const prData = ${{ steps.pr.outputs.result }};
94+
try {
95+
await github.rest.actions.createWorkflowDispatch({
96+
owner: context.repo.owner,
97+
repo: context.repo.repo,
98+
workflow_id: 'pro-integration-tests.yml',
99+
ref: prData.ref
100+
});
101+
console.log('✅ Triggered pro-integration-tests.yml');
102+
} catch (error) {
103+
console.error('❌ Failed to trigger pro-integration-tests.yml:', error.message);
104+
}
105+
106+
- name: Trigger Pro package tests
107+
uses: actions/github-script@v7
108+
with:
109+
script: |
110+
const prData = ${{ steps.pr.outputs.result }};
111+
try {
112+
await github.rest.actions.createWorkflowDispatch({
113+
owner: context.repo.owner,
114+
repo: context.repo.repo,
115+
workflow_id: 'pro-package-tests.yml',
116+
ref: prData.ref
117+
});
118+
console.log('✅ Triggered pro-package-tests.yml');
119+
} catch (error) {
120+
console.error('❌ Failed to trigger pro-package-tests.yml:', error.message);
121+
}

0 commit comments

Comments
 (0)