Skip to content

Commit

Permalink
Merge branch 'test2' into test3
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Apr 9, 2024
2 parents 1cffcae + 348d9dc commit 84cfc24
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions .github/workflows/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,34 +85,15 @@ jobs:
state: CUSTOM_STATE = 'success'
} = contentJSON;
// Fetch the first job ID from the workflow run
async function fetchAllJobs(owner, repo, run_id) {
let allJobs = [];
let page = 1;
const perPage = 100; // Adjust this value as needed, up to a maximum of 100
while (true) {
const response = await github.rest.actions.listJobsForWorkflowRun({
owner: owner,
repo: repo,
run_id: run_id,
per_page: perPage,
page: page
});
console.log(page, response);
allJobs = allJobs.concat(response.data.jobs);
console.log(allJobs);
if (response.data.jobs.length < perPage) {
console.log("break");
break; // No more jobs to fetch, exit the loop
}
page++; // Increment the page number to fetch the next set of jobs
// Fetch all jobs using pagination
const jobs = await github.paginate(
github.rest.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: process.env.WORKFLOW_RUN_ID,
}
return allJobs;
}
const jobs = await fetchAllJobs(context.repo.owner, context.repo.repo, process.env.WORKFLOW_RUN_ID);
);
//console.log(JSON.stringify(jobs.data.jobs, undefined, 2));
const job = jobs.find(job => job.name === JOB_NAME);
Expand Down

0 comments on commit 84cfc24

Please sign in to comment.