@@ -30,36 +30,65 @@ jobs:
3030
3131 backend-status-check :
3232 runs-on : ubuntu-latest
33- needs : [changed-files]
34- if : always()
3533 steps :
36- - name : " Post status based on whether builds will run"
34+ - name : " Check if builds will run and post status "
3735 uses : actions/github-script@v7
3836 with :
3937 script : |
40- const hasCodeChanges = '${{ needs.changed-files.outputs.has_code_changes }}' === 'true';
4138 const sha = context.sha;
39+ const owner = context.repo.owner;
40+ const repo = context.repo.repo;
41+
42+ // Wait a bit for jobs to start
43+ await new Promise(resolve => setTimeout(resolve, 5000));
44+
45+ // Get the current workflow run
46+ const workflowRun = await github.rest.actions.getWorkflowRun({
47+ owner,
48+ repo,
49+ run_id: context.runId
50+ });
51+
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+ });
58+
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+ );
64+
65+ const anyRunning = backendJobs.some(job =>
66+ job.status === 'queued' || job.status === 'in_progress'
67+ );
68+
69+ console.log(`Backend jobs found: ${backendJobs.length}`);
70+ console.log(`Any running: ${anyRunning}`);
4271
43- if (!hasCodeChanges ) {
44- // Builds won't run , post helpful message
72+ if (!anyRunning && backendJobs.length > 0 ) {
73+ // Builds are not running , post helpful message
4574 const message = `Use /ok to test ${sha.substring(0, 7)} to run CI`;
4675
4776 await github.rest.repos.createCommitStatus({
48- owner: context.repo.owner ,
49- repo: context.repo.repo ,
50- sha: sha ,
77+ owner,
78+ repo,
79+ sha,
5180 state: 'success',
5281 context: 'backend-status-check',
5382 description: message
5483 });
5584 } else {
56- // Builds are running, wait for them to complete
85+ // Builds are running or queued, show pending status
5786 const message = 'Waiting for build and test jobs to complete...';
5887
5988 await github.rest.repos.createCommitStatus({
60- owner: context.repo.owner ,
61- repo: context.repo.repo ,
62- sha: sha ,
89+ owner,
90+ repo,
91+ sha,
6392 state: 'pending',
6493 context: 'backend-status-check',
6594 description: message
0 commit comments