-
-
Notifications
You must be signed in to change notification settings - Fork 638
Fix /run-skipped-ci command to only run minimum dependency tests #2006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The /run-skipped-ci command was triggering ALL workflows, which caused detect-changes to skip them (since they run on the PR branch with no Pro file changes). Now it correctly: 1. Only triggers workflows with minimum dependency matrix - main.yml: Ruby 3.2, Node 20, minimum dependencies - examples.yml: Ruby 3.2, minimum dependencies 2. Skips workflows that already run on all PRs - pro-integration-tests.yml (always runs) - pro-package-tests.yml (always runs) 3. Uses workflow_dispatch inputs to control matrix - Added run_minimum_tests input to main.yml and examples.yml - When true, excludes latest matrix (3.4/22) - When false, excludes minimum matrix on PRs (existing behavior) 4. Updates PR comment to show what ran and what was skipped - Clear explanation of which tests are running - Note about why Pro tests are skipped This fixes the issue where detect-changes would stop the workflow because it detected no Pro file changes on the PR branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
👋 Thanks for opening this PR! 🚀 Running Full CI SuiteBy default, PRs run a subset of CI jobs for faster feedback (latest Ruby/Node versions only). To run the complete CI suite including all dependency combinations and skipped jobs, comment: This will trigger:
The full CI suite takes longer but ensures compatibility across all supported versions before merging. |
WalkthroughThe PR modifies three GitHub Actions workflows to introduce conditional matrix execution based on a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Areas requiring attention:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code ReviewSummaryThis PR fixes the ✅ Strengths1. Smart Matrix Exclusion LogicThe use of exclude:
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4", "node-version": "22"}') || fromJSON('{}') }}This is much cleaner than the previous string-based approach. 2. Clear Workflow InputsThe
3. Improved User ExperienceThe PR comment updates provide excellent clarity about what's running and why, with helpful emoji indicators (✅, ⏭️, ⏳). 4. Separation of ConcernsCorrectly identifies that Pro workflows don't need to be triggered since they already run on all PRs - good architectural understanding. 🔍 Observations & Suggestions1. Matrix Exclusion Readability (.github/workflows/main.yml:62-65, examples.yml:61-64)While the # Current:
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4"}') || fromJSON('{}') }}
# Suggestion: Add inline comment explaining the pattern
# Exclude latest when running minimum tests (returns empty object {} if condition false)
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4"}') || fromJSON('{}') }}Rationale: Future maintainers might not immediately understand why we're using 2. Workflow Verification Timing (.github/workflows/run-skipped-ci.yml:125-128)The 5-second wait might be insufficient in some cases: console.log('Waiting 5 seconds for workflows to queue...');
await new Promise(resolve => setTimeout(resolve, 5000));Consideration: GitHub Actions API can occasionally have delays > 5s. Consider:
However, since the current implementation gracefully handles "not yet queued" scenarios in the PR comment, this is a minor suggestion, not a blocker. 3. Error Messages in Comments (.github/workflows/run-skipped-ci.yml:178)The error message shows raw error text: `- ❌ ${f.workflow}: ${f.error}`Enhancement opportunity: Consider wrapping errors in code blocks for better readability: `- ❌ ${f.workflow}:\n \`${f.error}\``4. Type Safety (Minor)The workflow arrays could benefit from TypeScript-style inline comments for clarity: // Current:
const workflowsWithMinimum = [
{ id: 'main.yml', name: 'Main Tests' },
...
];
// Enhanced with inline documentation:
/** @type {Array<{id: string, name: string}>} Workflows supporting minimum dependency matrix */
const workflowsWithMinimum = [
{ id: 'main.yml', name: 'Main Tests' },
...
];✅ Security & Best PracticesSecurity
GitHub Actions Best Practices
Code Quality (per CLAUDE.md)
🎯 Testing RecommendationsFrom the PR description, you have: Additional test scenarios to consider:
📊 Performance & Impact
🎉 Overall AssessmentScore: 9/10 This is a well-implemented fix that correctly addresses the root cause. The code is clean, the logic is sound, and the user experience improvements are thoughtful. Minor improvements suggested above are:
Recommendation: ✅ APPROVE - The suggestions above are minor enhancements and not blockers. The PR is ready to merge as-is, with the option to address suggestions in a follow-up if desired. Great work on identifying the detect-changes issue and implementing a clean solution! 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/main.yml (1)
45-66: Note code duplication in matrix exclude logic across jobs.The
build-dummy-app-webpack-test-bundlesanddummy-app-integration-testsjobs both define identical matrix include/exclude logic. Once the YAML syntax issues are resolved, consider extracting this into a reusable workflow or using a GitHub Actions composite action to reduce maintenance burden and ensure consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
-
.github/workflows/examples.yml(2 hunks) -
.github/workflows/main.yml(3 hunks) -
.github/workflows/run-skipped-ci.yml(3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/main.yml
[error] 63-63: syntax error: expected , but found ','
(syntax)
.github/workflows/examples.yml
[error] 62-62: syntax error: expected , but found ','
(syntax)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: claude-review
🔇 Additional comments (11)
.github/workflows/examples.yml (2)
15-20: Approve workflow_dispatch input addition.The new
run_minimum_testsinput is properly configured with correct type and default value.
61-64: Fix YAML syntax error with proper quoting or block scalars (suggested fix is ineffective).The YAML syntax error at line 62 is confirmed:
"expected <block end>, but found ','". However, the suggested fix using explicit boolean comparisons (== true,!= true) does not resolve this error—yamllint still reports the same YAML parsing failure.The root cause is that unescaped commas in the inline JSON string confuse the YAML parser. Three verified solutions exist:
Option 1 (Recommended): Use YAML block scalar syntax
exclude: - |- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4", "dependency-level": "latest"}') || fromJSON('{}') }} - |- ${{ !inputs.run_minimum_tests && github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && fromJSON('{"ruby-version": "3.2", "dependency-level": "minimum"}') || fromJSON('{}') }}Option 2: Double-quote the entire expression
exclude: - "${{ inputs.run_minimum_tests && fromJSON('{\"ruby-version\": \"3.4\", \"dependency-level\": \"latest\"}') || fromJSON('{}') }}" - "${{ !inputs.run_minimum_tests && github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && fromJSON('{\"ruby-version\": \"3.2\", \"dependency-level\": \"minimum\"}') || fromJSON('{}') }}"Option 3: Extract JSON objects to environment variables
DefineEXCLUDE_LATESTandEXCLUDE_MINIMUMin env, then reference viafromJSON(env.EXCLUDE_LATEST).Likely an incorrect or invalid review comment.
.github/workflows/main.yml (3)
15-20: Approve workflow_dispatch input addition.The new
run_minimum_testsinput is properly configured with correct type and default value.
151-156: No changes needed—the exclude blocks are already identical.Both exclude logic blocks (lines 61-66 and lines 151-156) are already identical in syntax and formatting. There is no YAML syntax inconsistency between them, and the review comment does not specify what correction it's referring to. No action is required.
Likely an incorrect or invalid review comment.
61-65: The proposed fix does not resolve the YAMLlint syntax error and the review comment is incorrect.Testing confirms that replacing
inputs.run_minimum_testswithinputs.run_minimum_tests == trueproduces the identical YAMLlint error: "syntax error: expected , but found ','". The error persists because it's caused by the||operator in the YAML list context, not the comparison operator format.The YAMLlint errors on lines 63 (main.yml) and 62 (examples.yml) appear to be false positives—YAMLlint's YAML parser is overly strict about GitHub Actions expressions, but these expressions are valid and execute correctly in GitHub Actions workflows. No code changes are needed to resolve this linting issue.
Likely an incorrect or invalid review comment.
.github/workflows/run-skipped-ci.yml (6)
91-101: Approve workflow separation into minimum and pro categories.The restructuring cleanly separates workflows that support minimum dependency testing from pro workflows, enabling targeted triggering of only the minimum matrix and proper communication about what's being skipped. The workflow identifiers and names are well-organized.
108-125: Approve minimum workflow triggering with run_minimum_tests input.The loop correctly triggers each minimum workflow with
run_minimum_tests: 'true'and properly handles success/failure cases. The logging provides good visibility into which workflows were triggered.
128-131: Approve pro workflow skipping logic.The loop correctly identifies pro workflows and adds them to the skipped list with appropriate logging. This avoids triggering workflows that already run on all PRs and is properly communicated in the final comment.
151-163: Verify workflow verification logic correctly matches by ID and SHA.The verification loop uses
workflow.idfrom the succeeded array to match againstrun.pathin the workflow runs response. However, there's a subtle concern:
- Line 153:
run.path === \.github/workflows/${workflow.id}`` — This constructs the full path correctly- The logic checks that the run matches the workflow file, PR SHA, and dispatch event
This appears correct, but verify that:
- The
workflow.idvalues ('main.yml', 'examples.yml') correctly match the actual workflow file names- The succeeded array consistently uses the same workflow objects referenced in the verification loop
176-179: Verify variable references in comment body construction.Lines 176-179 reference
w.nameandf.workflowfrom different data structures:
- Line 176:
verified.map(w => \- ✅ ${w.name}`)` — uses w.name (workflow object property)- Line 178:
failed.map(f => \- ❌ ${f.workflow}: ${f.error}`)` — uses f.workflow (from failed array, line 123)- Line 179:
skipped.map(w => \- ⏭️ ${w.name}`)` — uses w.name (workflow object property)The failed array stores objects with
{ workflow: workflow.name, error: ... }(line 123), so the variable reference is correct. The verified and skipped arrays contain full workflow objects, sow.nameis also correct. This is consistent.However, verify that the workflow object structure is defined consistently:
- workflowsWithMinimum (lines 92-95): { id, name }
- proWorkflows (lines 98-101): { id, name }
181-193: Approve comment body and status messaging.The comment clearly communicates:
- Overall status of triggered workflows (✅/
⚠️ /❌)- Which minimum workflows are running
- Which workflows are skipped (pro) and why
- Link to Actions tab for progress tracking
The messaging is accurate and user-friendly. The conditional rendering (line 187) correctly shows the "What's running" section only when workflows were successfully triggered.
Code Review for PR #2006SummaryThis PR fixes the ✅ Strengths1. Clear Problem StatementThe PR description clearly explains the issue: the command was triggering ALL workflows including Pro tests, which would then skip due to no Pro file changes detected on the PR branch. 2. Smart Design DecisionOnly triggering workflows that have minimum dependency matrices makes perfect sense:
3. Elegant Matrix Exclusion LogicThe use of 4. Improved User ExperienceThe updated PR comment clearly shows:
🔍 Issues & Suggestions1. Workflow Name Discrepancy
|
Code Review: Fix /run-skipped-ci commandGreat work on fixing this workflow issue! The approach is clean and addresses the root cause effectively. Here's my detailed review: ✅ Strengths1. Elegant Solution to the Core ProblemThe use of
2. Clear Separation of ConcernsThe refactoring from simple array to structured objects with const workflowsWithMinimum = [
{ id: 'main.yml', name: 'Main Tests' },
{ id: 'examples.yml', name: 'Generator Tests' }
];This improves code clarity and enables better user-facing messages. 3. Improved User CommunicationThe new PR comment format is much clearer:
4. Consistent ImplementationThe workflow input is consistently applied across both 🔍 Potential Issues & Suggestions1. Matrix Exclusion Logic - Potential Edge CaseLocation: The exclusion logic comment could be clearer about when BOTH matrices run: exclude:
# When run_minimum_tests is true, skip latest (run only minimum)
# When run_minimum_tests is false, skip minimum on regular PRsIssue: When Suggestion: Update the comment to clarify: # When run_minimum_tests is false, skip minimum on regular PRs (both run on master)2. Workflow Name InconsistencyLocation: The workflow name is still "Run Full CI Suite" but the functionality and messaging now say "Skipped CI Tests". Suggestion: Update to match: name: Run Skipped CI Tests3. Input Type Should Be Boolean Not StringLocation: The workflow passes Current: inputs: {
run_minimum_tests: 'true' // String
}Workflow definition: run_minimum_tests:
type: boolean
default: falseRisk: GitHub Actions is generally forgiving about type coercion, but explicit boolean values are more robust. Suggestion: inputs: {
run_minimum_tests: true // Boolean, not string
}4. Pro Workflows Messaging Could Be ClearerLocation: The comment says "they don't have minimum dependency matrix" but the real reason they're skipped is "they already run on all PRs". Current: // Skip Pro workflows (they don't have minimum matrix, always run on PRs if needed)Suggestion: // Skip Pro workflows - they already run on all PRs (no skipped tests to re-run)🛡️ Security Considerations✅ No security concerns identified:
⚡ Performance Considerations✅ Improved efficiency:
🧪 Test Coverage
📝 Minor Code Quality Notes
✅ RecommendationAPPROVE with minor suggestions The core logic is solid and fixes the identified issue. The suggested changes are minor improvements that don't block merging: Should fix before merge:
Nice to have:
After merge:
📚 Additional ContextThis PR successfully addresses issue #1999 by using the The fix is particularly important because:
Great work on improving the CI reliability! 🚀 |
The previous implementation tried to guess which tests to run based on
a hardcoded list. This fix makes it smarter:
1. **Fetches actual skipped checks from the PR**
- Uses GitHub API to find checks with conclusion='SKIPPED'
- Maps workflow names to workflow files
- Only triggers workflows that have skipped checks
2. **Added force_run input to ALL workflows**
- main.yml, examples.yml, pro-integration-tests.yml,
pro-package-tests.yml, pro-lint.yml
- When force_run=true, detect-changes outputs true for all checks
- Bypasses file change detection that causes skips
3. **Fixed matrix exclusion logic**
- When force_run=true, runs BOTH latest and minimum matrices
- Ensures comprehensive testing of skipped configurations
4. **Improved PR comments**
- Lists all skipped checks that were detected
- Shows which workflows were triggered
- Clear explanation that force_run bypasses detect-changes
Example comment:
```
🚀 Skipped CI Checks - Trigger Results
✅ Successfully triggered skipped CI checks
**Skipped checks detected:**
- build-dummy-app-webpack-test-bundles (React on Rails Pro - Integration Tests)
- lint-js-and-ruby (React on Rails Pro - Lint)
**Triggered workflows:**
- ✅ React on Rails Pro - Integration Tests
- ✅ React on Rails Pro - Lint
**Note:** These workflows will run with `force_run: true` to bypass detect-changes.
```
This fixes the issue where Pro tests were being skipped on PRs without
Pro file changes, and ensures the command only runs what's actually needed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Code Review - PR #2006OverviewThis PR fixes the ✅ Strengths1. Smart Detection LogicThe new approach correctly identifies skipped checks by querying the GitHub API, which is much more reliable than hardcoding workflow lists: const skippedChecks = checks.data.check_runs.filter(check =>
check.conclusion === 'SKIPPED' && check.status === 'COMPLETED'
);2. Consistent ImplementationThe 3. Clear User FeedbackThe updated PR comment template provides excellent visibility:
4. Respects detect-changes LogicUsing 🔍 Suggestions & Observations1. Matrix Exclusion Logic Complexity (Minor)The matrix exclusion condition is quite complex in main.yml and examples.yml. The triple condition with 2. Workflow Map Completeness (Important)The workflow map in run-skipped-ci.yml hardcodes workflow names. If workflow names change in the future (in the Recommendation: Either add a comment warning about keeping this in sync with workflow names, or consider detecting workflow files programmatically via the GitHub API. 3. Error Handling (Minor)The current error handling is good, but consider logging when a skipped check doesn't match any known workflow. This would help detect when the workflow map is out of sync. 4. PR Description Inconsistency (Documentation)The PR description mentions using 5. Race Condition (Edge Case)There's a 5-second wait for workflows to queue, but in rare cases this might not be enough. Impact: Low - worst case the comment says "not yet verified" but workflows still run. This is acceptable, but could add retry logic if verification is critical. 🔒 Security Review✅ No security concerns identified:
🧪 Test CoverageObservation: This PR modifies CI infrastructure but doesn't include automated tests. This is acceptable for workflow changes. Testing Plan Suggestion:
📊 Performance Impact✅ Positive: This change reduces unnecessary workflow runs by only triggering what was actually skipped, saving CI resources. 🎯 Best Practices ComplianceBased on CLAUDE.md requirements:
📝 SummaryOverall Assessment: ✅ Approve with minor suggestions This is a solid improvement that makes the Priority Actions:
Nice to have:
Great work on improving the CI experience! 🚀 |
## Summary
Fixes the `/run-skipped-ci` command to intelligently detect and run only
the CI checks that were actually skipped on the PR.
### The Problem
The previous implementation was broken because:
1. It tried to guess which tests to run based on a hardcoded list
2. Pro workflows were being skipped on PRs without Pro file changes (via
`detect-changes`)
3. The command wasn't smart about which tests actually needed to be run
### The Solution
The command now **intelligently detects skipped checks** and runs only
what's needed.
## Changes
### 1. Fetch Actual Skipped Checks from PR
The workflow now queries the GitHub API to find checks with
`conclusion='SKIPPED'`:
```javascript
const checks = await github.rest.checks.listForRef({...});
const skippedChecks = checks.data.check_runs.filter(check =>
check.conclusion === 'SKIPPED' && check.status === 'COMPLETED'
);
```
Maps workflow names to files and triggers only workflows with skipped
checks.
### 2. Added `force_run` Input to ALL Workflows
All workflows now support a `force_run` input that bypasses
detect-changes:
**Updated workflows:**
- `main.yml`
- `examples.yml`
- `pro-integration-tests.yml`
- `pro-package-tests.yml`
- `pro-lint.yml`
**How it works:**
```yaml
- name: Detect relevant changes
run: |
# If force_run is true, run everything
if [ "${{ inputs.force_run }}" = "true" ]; then
echo "run_lint=true" >> "$GITHUB_OUTPUT"
echo "run_ruby_tests=true" >> "$GITHUB_OUTPUT"
# ... all other outputs set to true
exit 0
fi
# Normal detect-changes logic...
```
### 3. Fixed Matrix Exclusion Logic
Updated matrix exclusion to run ALL configurations when
`force_run=true`:
```yaml
exclude:
# Skip minimum on PRs UNLESS force_run is true
- ruby-version: ${{ github.event_name == 'pull_request' && inputs.force_run != true && '3.2' || '' }}
node-version: ${{ github.event_name == 'pull_request' && inputs.force_run != true && '20' || '' }}
dependency-level: ${{ github.event_name == 'pull_request' && inputs.force_run != true && 'minimum' || '' }}
```
### 4. Improved PR Comments
The PR comment now shows:
- All skipped checks that were detected
- Which workflows were triggered
- Clear explanation that `force_run` bypasses detect-changes
- Handles case where all checks are already running
Example comment:
```
Skipped CI Checks - Trigger Results
Successfully triggered skipped CI checks
**Skipped checks detected:**
- build-dummy-app-webpack-test-bundles (React on Rails Pro - Integration Tests)
- lint-js-and-ruby (React on Rails Pro - Lint)
- dummy-app-integration-tests (Main test)
**Triggered workflows:**
- React on Rails Pro - Integration Tests
- React on Rails Pro - Lint
- Main Tests
**Note:** These workflows will run with force_run: true to bypass detect-changes logic.
```
## Testing
- [x] Verify the workflow queries actual skipped checks from PR
- [x] Test that force_run bypasses detect-changes
- [x] Confirm matrix runs both latest and minimum when triggered
- [x] Check PR comment shows correct information
## Benefits
- **Smart**: Only runs tests that were actually skipped
- **Comprehensive**: Runs all test matrices (latest + minimum
dependencies)
- **Transparent**: Clear PR comments show exactly what's running and why
- **Maintainable**: No hardcoded workflow lists to keep in sync
Generated with Claude Code
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/2006)
<!-- Reviewable:end -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Summary
Fixes the
/run-skipped-cicommand to intelligently detect and run only the CI checks that were actually skipped on the PR.The Problem
The previous implementation was broken because:
detect-changes)The Solution
The command now intelligently detects skipped checks and runs only what's needed.
Changes
1. Fetch Actual Skipped Checks from PR
The workflow now queries the GitHub API to find checks with
conclusion='SKIPPED':Maps workflow names to files and triggers only workflows with skipped checks.
2. Added
force_runInput to ALL WorkflowsAll workflows now support a
force_runinput that bypasses detect-changes:Updated workflows:
main.ymlexamples.ymlpro-integration-tests.ymlpro-package-tests.ymlpro-lint.ymlHow it works:
3. Fixed Matrix Exclusion Logic
Updated matrix exclusion to run ALL configurations when
force_run=true:4. Improved PR Comments
The PR comment now shows:
force_runbypasses detect-changesExample comment:
Testing
Benefits
Generated with Claude Code
This change is