capabilities.work

Cancel a Workflow Run and Confirm

A 4-step recipe with GitHub Actions. We can help you get access.

Recipe · 4 steps

Cancel a Workflow Run and Confirm

with GitHub Actions · Continuous Integration Management
Works with AI assistants

Cancel a run and confirm it stopped, force-cancelling if necessary.

  1. Fetch the run to confirm it exists and read its current status before attempting cancellation.
  2. Request a normal cancellation of the run. The API returns 202 to acknowledge the cancellation request.
  3. Poll the run until it is no longer in_progress. Loop while still running; force-cancel if it remains queued and end once it has stopped.
  4. Force cancel the run when the normal cancel request did not take effect. The API returns 202 to acknowledge the force cancellation request.
What you'll need to have ready
  • accessToken: GitHub bearer token with Actions write access.
  • owner: The account owner of the repository.
  • repo: The name of the repository without the .git extension.
  • runId: The unique identifier of the workflow run to cancel.
For your developer

Arazzo workflow github-actions:cancel-run, 4 operations: getWorkflowRun → cancelWorkflowRun → getWorkflowRun → forceCancelWorkflowRun. Specs on APIs.io.