Skip to content

Commit a96800d

Browse files
justin808claude
andcommitted
Fix /run-skipped-ci to only run minimum dependency tests
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 <[email protected]>
1 parent 8d2f1dd commit a96800d

File tree

3 files changed

+67
-37
lines changed

3 files changed

+67
-37
lines changed

.github/workflows/examples.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ on:
1212
- '**.md'
1313
- 'docs/**'
1414
workflow_dispatch:
15+
inputs:
16+
run_minimum_tests:
17+
description: 'Run minimum dependency matrix (Ruby 3.2)'
18+
required: false
19+
type: boolean
20+
default: false
1521

1622
jobs:
1723
detect-changes:
@@ -52,9 +58,10 @@ jobs:
5258
- ruby-version: '3.2'
5359
dependency-level: 'minimum'
5460
exclude:
55-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
56-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
57-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
61+
# When run_minimum_tests is true, skip latest (run only minimum)
62+
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4", "dependency-level": "latest"}') || fromJSON('{}') }}
63+
# When run_minimum_tests is false, skip minimum on regular PRs (run only on master/workflow_dispatch)
64+
- ${{ !inputs.run_minimum_tests && github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && fromJSON('{"ruby-version": "3.2", "dependency-level": "minimum"}') || fromJSON('{}') }}
5865
env:
5966
SKIP_YARN_COREPACK_CHECK: 0
6067
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}

.github/workflows/main.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ on:
1212
- '**.md'
1313
- 'docs/**'
1414
workflow_dispatch:
15+
inputs:
16+
run_minimum_tests:
17+
description: 'Run minimum dependency matrix (Ruby 3.2, Node 20)'
18+
required: false
19+
type: boolean
20+
default: false
1521

1622
jobs:
1723
detect-changes:
@@ -53,10 +59,10 @@ jobs:
5359
node-version: '20'
5460
dependency-level: 'minimum'
5561
exclude:
56-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
57-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
58-
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '20' || '' }}
59-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
62+
# When run_minimum_tests is true, skip latest (run only minimum)
63+
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4", "node-version": "22", "dependency-level": "latest"}') || fromJSON('{}') }}
64+
# When run_minimum_tests is false, skip minimum on regular PRs (run only on master/workflow_dispatch)
65+
- ${{ !inputs.run_minimum_tests && github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && fromJSON('{"ruby-version": "3.2", "node-version": "20", "dependency-level": "minimum"}') || fromJSON('{}') }}
6066
runs-on: ubuntu-22.04
6167
steps:
6268
- uses: actions/checkout@v4
@@ -143,10 +149,10 @@ jobs:
143149
node-version: '20'
144150
dependency-level: 'minimum'
145151
exclude:
146-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
147-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
148-
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '20' || '' }}
149-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
152+
# When run_minimum_tests is true, skip latest (run only minimum)
153+
- ${{ inputs.run_minimum_tests && fromJSON('{"ruby-version": "3.4", "node-version": "22", "dependency-level": "latest"}') || fromJSON('{}') }}
154+
# When run_minimum_tests is false, skip minimum on regular PRs (run only on master/workflow_dispatch)
155+
- ${{ !inputs.run_minimum_tests && github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && fromJSON('{"ruby-version": "3.2", "node-version": "20", "dependency-level": "minimum"}') || fromJSON('{}') }}
150156
runs-on: ubuntu-22.04
151157
steps:
152158
- uses: actions/checkout@v4

.github/workflows/run-skipped-ci.yml

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,49 @@ jobs:
8787
with:
8888
script: |
8989
const prData = ${{ steps.pr.outputs.result }};
90-
const workflows = [
91-
'main.yml',
92-
'examples.yml',
93-
'pro-integration-tests.yml',
94-
'pro-package-tests.yml'
90+
91+
// Workflows that support minimum dependency testing
92+
const workflowsWithMinimum = [
93+
{ id: 'main.yml', name: 'Main Tests' },
94+
{ id: 'examples.yml', name: 'Generator Tests' }
95+
];
96+
97+
// Pro workflows always run (no minimum matrix)
98+
const proWorkflows = [
99+
{ id: 'pro-integration-tests.yml', name: 'Pro Integration Tests' },
100+
{ id: 'pro-package-tests.yml', name: 'Pro Package Tests' }
95101
];
96102
97103
const succeeded = [];
98104
const failed = [];
105+
const skipped = [];
99106
100-
// Trigger all workflows
101-
for (const workflowId of workflows) {
107+
// Trigger workflows with minimum dependency testing
108+
for (const workflow of workflowsWithMinimum) {
102109
try {
103110
await github.rest.actions.createWorkflowDispatch({
104111
owner: context.repo.owner,
105112
repo: context.repo.repo,
106-
workflow_id: workflowId,
107-
ref: prData.ref
113+
workflow_id: workflow.id,
114+
ref: prData.ref,
115+
inputs: {
116+
run_minimum_tests: 'true'
117+
}
108118
});
109-
console.log(`✅ Triggered ${workflowId}`);
110-
succeeded.push(workflowId);
119+
console.log(`✅ Triggered ${workflow.id} with run_minimum_tests=true`);
120+
succeeded.push(workflow);
111121
} catch (error) {
112-
console.error(`❌ Failed to trigger ${workflowId}:`, error.message);
113-
failed.push({ workflow: workflowId, error: error.message });
122+
console.error(`❌ Failed to trigger ${workflow.id}:`, error.message);
123+
failed.push({ workflow: workflow.name, error: error.message });
114124
}
115125
}
116126
127+
// Skip Pro workflows (they don't have minimum matrix, always run on PRs if needed)
128+
for (const workflow of proWorkflows) {
129+
console.log(`⏭️ Skipping ${workflow.id} (no minimum dependency matrix)`);
130+
skipped.push(workflow);
131+
}
132+
117133
// Wait a bit for workflows to queue
118134
if (succeeded.length > 0) {
119135
console.log('Waiting 5 seconds for workflows to queue...');
@@ -132,23 +148,23 @@ jobs:
132148
created: `>${new Date(Date.now() - 60000).toISOString()}`
133149
});
134150
135-
for (const workflowId of succeeded) {
151+
for (const workflow of succeeded) {
136152
const found = runs.data.workflow_runs.some(run =>
137-
run.path === `.github/workflows/${workflowId}` &&
153+
run.path === `.github/workflows/${workflow.id}` &&
138154
run.head_sha === prData.sha &&
139155
run.event === 'workflow_dispatch'
140156
);
141157
142158
if (found) {
143-
verified.push(workflowId);
159+
verified.push(workflow);
144160
} else {
145-
notFound.push(workflowId);
161+
notFound.push(workflow);
146162
}
147163
}
148164
}
149165
150166
// Build the comment body based on actual results
151-
let status = '✅ **Successfully triggered and verified all workflows**';
167+
let status = '✅ **Successfully triggered skipped CI tests**';
152168
if (failed.length > 0 && notFound.length > 0) {
153169
status = '❌ **Failed to trigger or verify workflows**';
154170
} else if (failed.length > 0) {
@@ -157,21 +173,22 @@ jobs:
157173
status = '⚠️ **Workflows triggered but not yet verified**';
158174
}
159175
160-
const verifiedList = verified.length > 0 ? verified.map(w => `- ✅ ${w}`).join('\n') : '';
161-
const notFoundList = notFound.length > 0 ? `\n\n**Triggered but not yet queued (may still start):**\n${notFound.map(w => `- ⏳ ${w}`).join('\n')}` : '';
176+
const verifiedList = verified.length > 0 ? verified.map(w => `- ✅ ${w.name}`).join('\n') : '';
177+
const notFoundList = notFound.length > 0 ? `\n\n**Triggered but not yet queued (may still start):**\n${notFound.map(w => `- ⏳ ${w.name}`).join('\n')}` : '';
162178
const failedList = failed.length > 0 ? `\n\n**Failed to trigger:**\n${failed.map(f => `- ❌ ${f.workflow}: ${f.error}`).join('\n')}` : '';
179+
const skippedList = skipped.length > 0 ? `\n\n**Skipped (already run on PRs):**\n${skipped.map(w => `- ⏭️ ${w.name}`).join('\n')}` : '';
163180
164-
const body = `🚀 **Full CI Suite Results**
181+
const body = `🚀 **Skipped CI Tests Triggered**
165182
166183
${status}
167184
168-
${verifiedList ? `**Verified workflows:**\n${verifiedList}` : ''}${notFoundList}${failedList}
185+
${verifiedList ? `**Running minimum dependency tests:**\n${verifiedList}` : ''}${notFoundList}${failedList}${skippedList}
169186
170-
${verified.length > 0 ? `\nThese will run all CI jobs including those normally skipped on PRs:
187+
${verified.length > 0 ? `\n**What's running:**
171188
- ✅ Minimum dependency versions (Ruby 3.2, Node 20)
172-
- ✅ All example app tests
173-
- ✅ Pro package integration tests
174-
- ✅ Pro package unit tests
189+
- ✅ Generator tests with minimum dependencies
190+
191+
**Note:** Pro package tests and latest dependency tests are skipped because they already run on all PRs.
175192
176193
View progress in the [Actions tab](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions).` : ''}`;
177194

0 commit comments

Comments
 (0)