Skip to content

fix: paginate workflow run cancellation#219

Open
jay-babu wants to merge 1 commit into
styfle:mainfrom
jay-babu:fix/paginate-workflow-runs
Open

fix: paginate workflow run cancellation#219
jay-babu wants to merge 1 commit into
styfle:mainfrom
jay-babu:fix/paginate-workflow-runs

Conversation

@jay-babu

Copy link
Copy Markdown

Summary

  • paginate listWorkflowRuns so the action considers every matching workflow run, not just the first 100 returned by the API
  • when only_status is set and all_but_latest is not set, pass that status to the API so runs in statuses like waiting are not hidden behind recent completed runs
  • keep all_but_latest semantics by fetching all statuses when that option is enabled

Fixes #218.

Test Plan

  • yarn format-check
  • yarn build
  • npx tsc --noEmit

Copilot AI review requested due to automatic review settings May 18, 2026 21:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the workflow-run retrieval logic to page through all workflow runs (instead of a single page) and conditionally filter by status, so downstream cancel-selection logic has a complete dataset.

Changes:

  • Replace listWorkflowRuns single-call response handling with octokit.paginate(...) to fetch all workflow runs.
  • Conditionally add a status filter when only_status is set (and all_but_latest is not).
  • Update logging to reflect the number of runs fetched.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/index.ts Switches workflow runs fetching to pagination and optionally applies status filtering.
dist/index.js Compiled output reflecting the updated pagination + status-filter logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts
Comment on lines +72 to +85
const listWorkflowRunsParams: any = {
per_page: 100,
owner,
repo,
// @ts-ignore
workflow_id,
branch,
});
console.log(`Found ${total_count} runs total.`);
};
if (only_status && !all_but_latest) {
listWorkflowRunsParams.status = only_status;
}
const workflow_runs: any[] = await octokit.paginate(
octokit.rest.actions.listWorkflowRuns,
listWorkflowRunsParams,
);
Comment thread src/index.ts
Comment on lines +82 to +85
const workflow_runs: any[] = await octokit.paginate(
octokit.rest.actions.listWorkflowRuns,
listWorkflowRunsParams,
);
Comment thread src/index.ts
});
console.log(`Found ${total_count} runs total.`);
};
if (only_status && !all_but_latest) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

only_status: waiting cancels only one older waiting run instead of all previous runs

2 participants