Skip to content

Commit 7f332c3

Browse files
committed
fix
Signed-off-by: alec-flowers <[email protected]>
1 parent 1efe7fc commit 7f332c3

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

.github/workflows/container-validation-backends.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030

3131
backend-status-check:
3232
runs-on: ubuntu-latest
33+
permissions:
34+
actions: read
35+
statuses: write
3336
steps:
3437
- name: "Check if builds will run and post status"
3538
uses: actions/github-script@v7
@@ -39,38 +42,44 @@ jobs:
3942
const owner = context.repo.owner;
4043
const repo = context.repo.repo;
4144
42-
// Wait a bit for jobs to start
43-
await new Promise(resolve => setTimeout(resolve, 5000));
45+
// Poll for jobs to appear, waiting up to 30 seconds
46+
let backendJobs = [];
47+
const backendJobNames = ['vllm', 'sglang', 'trtllm', 'operator'];
4448
45-
// Get the current workflow run
46-
const workflowRun = await github.rest.actions.getWorkflowRun({
47-
owner,
48-
repo,
49-
run_id: context.runId
50-
});
49+
for (let i = 0; i < 6; i++) {
50+
await new Promise(resolve => setTimeout(resolve, 5000));
5151
52-
// List all jobs in this workflow run
53-
const jobs = await github.rest.actions.listJobsForWorkflowRun({
54-
owner,
55-
repo,
56-
run_id: context.runId
57-
});
52+
const jobs = await github.rest.actions.listJobsForWorkflowRun({
53+
owner,
54+
repo,
55+
run_id: context.runId
56+
});
5857
59-
// Check if any of the backend build jobs are running or queued
60-
const backendJobNames = ['vllm', 'sglang', 'trtllm', 'operator'];
61-
const backendJobs = jobs.data.jobs.filter(job =>
62-
backendJobNames.some(name => job.name.includes(name))
63-
);
58+
backendJobs = jobs.data.jobs.filter(job =>
59+
backendJobNames.some(name => job.name.includes(name))
60+
);
61+
62+
console.log(`Poll ${i+1}: Found ${backendJobs.length} backend jobs`);
63+
64+
// If we found backend jobs, check their status
65+
if (backendJobs.length > 0) {
66+
break;
67+
}
68+
}
6469
6570
const anyRunning = backendJobs.some(job =>
6671
job.status === 'queued' || job.status === 'in_progress'
6772
);
73+
const anySkipped = backendJobs.some(job =>
74+
job.status === 'completed' && job.conclusion === 'skipped'
75+
);
6876
6977
console.log(`Backend jobs found: ${backendJobs.length}`);
7078
console.log(`Any running: ${anyRunning}`);
79+
console.log(`Any skipped: ${anySkipped}`);
7180
72-
if (!anyRunning && backendJobs.length > 0) {
73-
// Builds are not running, post helpful message
81+
if (backendJobs.length === 0 || (!anyRunning && backendJobs.length > 0)) {
82+
// Builds are not running or all skipped, post helpful message
7483
const message = `Use /ok to test ${sha.substring(0, 7)} to run CI`;
7584
7685
await github.rest.repos.createCommitStatus({
@@ -99,6 +108,8 @@ jobs:
99108
runs-on: ubuntu-latest
100109
needs: [vllm, sglang, trtllm, operator]
101110
if: always()
111+
permissions:
112+
statuses: write
102113
steps:
103114
- name: "Check all dependent jobs"
104115
uses: actions/github-script@v7

0 commit comments

Comments
 (0)