ci: pass workflow_run id to github-script via env (#1227)

This commit is contained in:
Mrityunjay Raj 2026-07-11 03:52:23 +05:30 committed by GitHub
parent f994180022
commit 398737fadc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,18 +41,22 @@ jobs:
- name: Get CI failure details
id: failure_details
uses: actions/github-script@v7
env:
RUN_ID: ${{ github.event.workflow_run.id }}
with:
script: |
const runId = Number(process.env.RUN_ID);
const run = await github.rest.actions.getWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }}
run_id: runId
});
const jobs = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }}
run_id: runId
});
const failedJobs = jobs.data.jobs.filter(job => job.conclusion === 'failure');