Skip to content

Commit 8da8871

Browse files
cdoernmergify[bot]
authored andcommitted
ci: add merge_group trigger to all PR-gating workflows (#5017)
# What does this PR do? Prepares CI for GitHub merge queue support on main and release-*.x branches. When merge queues are enabled, queue entries need to trigger the same checks that run on pull requests. - Add `merge_group` trigger to all 13 PR-gating workflows - Fix ci-status.yml concurrency group: use `github.ref` fallback since `github.event.pull_request.number` is null in merge_group context - Fix ci-status.yml SHA lookup: use `context.sha` fallback since `context.payload.pull_request.head.sha` is null in merge_group context - Scope backward-compat informational jobs (test-integration-release, check-schema-release-compatibility) to pull_request only — they call `gh pr comment/view` with the PR number which is unavailable in merge_group and would crash the job under bash set -e - Fix integration-tests.yml fork detection: null PR repo field in merge_group context was incorrectly evaluated as a fork PR Signed-off-by: Charlie Doern <cdoern@redhat.com> Co-authored-by: Francisco Javier Arceo <arceofrancisco@gmail.com> (cherry picked from commit 1b3623b) # Conflicts: # .github/workflows/ci-status.yml # .github/workflows/integration-responses-conversations-auth-tests.yml # .github/workflows/openapi-generator-validation.yml # .github/workflows/openresponses-conformance.yml
1 parent 22e56c7 commit 8da8871

13 files changed

Lines changed: 847 additions & 1 deletion

.github/workflows/backward-compat.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- 'src/llama_stack/distributions/**/config.yaml'
1616
- 'tests/backward_compat/**'
1717
- '.github/workflows/backward-compat.yml'
18+
merge_group:
19+
branches:
20+
- main
21+
- 'release-[0-9]+.[0-9]+.x'
1822

1923
concurrency:
2024
group: ${{ github.workflow }}-${{ github.ref }}
@@ -232,6 +236,7 @@ jobs:
232236
233237
test-integration-release:
234238
name: Run Integration Tests with Latest Release (Informational)
239+
if: github.event_name == 'pull_request'
235240
runs-on: ubuntu-latest
236241

237242
steps:
@@ -401,6 +406,7 @@ jobs:
401406

402407
check-schema-release-compatibility:
403408
name: Check Schema Compatibility with Latest Release (Informational)
409+
if: github.event_name == 'pull_request'
404410
runs-on: ubuntu-latest
405411

406412
steps:

.github/workflows/ci-status.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI Status
2+
3+
run-name: Aggregate CI check status
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- main
9+
- 'release-[0-9]+.[0-9]+.x'
10+
merge_group:
11+
branches:
12+
- main
13+
- 'release-[0-9]+.[0-9]+.x'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
ci-status:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 60
23+
permissions:
24+
checks: read
25+
steps:
26+
- name: Wait for CI checks to complete
27+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
28+
with:
29+
script: |
30+
const sha = context.payload.pull_request?.head.sha ?? context.sha;
31+
const owner = context.repo.owner;
32+
const repo = context.repo.repo;
33+
34+
// Wait for other workflows to get queued
35+
core.info('Waiting 60s for CI workflows to get queued...');
36+
await new Promise(r => setTimeout(r, 60000));
37+
38+
const excludedChecks = new Set(['ci-status']);
39+
const excludedApps = new Set(['mergify']);
40+
41+
const terminalStatuses = new Set(['completed']);
42+
const successConclusions = new Set(['success', 'skipped', 'neutral']);
43+
const failureConclusions = new Set(['failure', 'cancelled', 'timed_out']);
44+
45+
while (true) {
46+
const { data: checkRuns } = await github.rest.checks.listForRef({
47+
owner,
48+
repo,
49+
ref: sha,
50+
per_page: 100,
51+
});
52+
53+
// Filter to only GitHub Actions checks, excluding ourselves and bots
54+
const relevant = checkRuns.check_runs.filter(cr => {
55+
if (excludedChecks.has(cr.name)) return false;
56+
if (cr.app && excludedApps.has(cr.app.slug)) return false;
57+
// Only include GitHub Actions checks
58+
if (!cr.app || cr.app.slug !== 'github-actions') return false;
59+
return true;
60+
});
61+
62+
if (relevant.length === 0) {
63+
core.info('No other CI checks found yet, waiting...');
64+
await new Promise(r => setTimeout(r, 30000));
65+
continue;
66+
}
67+
68+
const pending = relevant.filter(cr => !terminalStatuses.has(cr.status));
69+
const completed = relevant.filter(cr => terminalStatuses.has(cr.status));
70+
71+
core.info(`Checks: ${completed.length} completed, ${pending.length} pending out of ${relevant.length} total`);
72+
73+
for (const cr of completed) {
74+
core.info(` ✓ ${cr.name}: ${cr.conclusion}`);
75+
}
76+
for (const cr of pending) {
77+
core.info(` ⏳ ${cr.name}: ${cr.status}`);
78+
}
79+
80+
if (pending.length > 0) {
81+
core.info('Waiting 30s for pending checks...');
82+
await new Promise(r => setTimeout(r, 30000));
83+
continue;
84+
}
85+
86+
// All checks completed — evaluate conclusions
87+
const failed = completed.filter(cr => failureConclusions.has(cr.conclusion));
88+
89+
if (failed.length > 0) {
90+
for (const cr of failed) {
91+
core.error(`${cr.name} concluded with: ${cr.conclusion}`);
92+
}
93+
core.setFailed(`${failed.length} CI check(s) failed.`);
94+
return;
95+
}
96+
97+
const succeeded = completed.filter(cr => successConclusions.has(cr.conclusion));
98+
core.info(`All ${succeeded.length} CI checks passed.`);
99+
return;
100+
}

.github/workflows/integration-auth-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
- 'requirements.txt'
2222
- '.github/workflows/integration-auth-tests.yml' # This workflow
2323
- 'scripts/integration-auth-tests.sh'
24+
merge_group:
25+
branches:
26+
- main
27+
- 'release-[0-9]+.[0-9]+.x'
2428

2529
concurrency:
2630
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}

0 commit comments

Comments
 (0)