GitHub Actions · Arazzo Workflow

GitHub Actions Cancel a Workflow Run and Confirm

Version 1.0.0

Get a run, request cancellation, poll until it is no longer in progress, and force-cancel if it gets stuck.

1 workflow 1 source API 1 provider
View Spec View on GitHub ArazzoWorkflows

Provider

github-actions

Workflows

cancel-run
Cancel a run and confirm it stopped, force-cancelling if necessary.
Reads the run, requests cancellation, polls until it is no longer in progress, and force-cancels when the normal cancel does not take effect.
4 steps inputs: accessToken, owner, repo, runId outputs: finalStatus, runId
1
getRun
Fetch the run to confirm it exists and read its current status before attempting cancellation.
2
cancelRun
Request a normal cancellation of the run. The API returns 202 to acknowledge the cancellation request.
3
pollRun
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
forceCancelRun
Force cancel the run when the normal cancel request did not take effect. The API returns 202 to acknowledge the force cancellation request.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: GitHub Actions Cancel a Workflow Run and Confirm
  summary: Get a run, request cancellation, poll until it is no longer in progress, and force-cancel if it gets stuck.
  description: >-
    Stops a workflow run and verifies that it actually stopped. The workflow
    fetches the run, requests a normal cancellation, polls the run until it
    leaves the in_progress state, and falls back to a force cancel when the run
    refuses to respond to the normal cancel request. Every step spells out its
    request inline so the flow can be read and executed without opening the
    underlying OpenAPI description.
  version: 1.0.0
  x-realizes-capability-ids:
  - BC-4210.10
  x-capability-derivation:
    method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
    min_confidence: 0.7
    sources:
    - capability_id: BC-4210.10
      capability_name: Continuous Integration Management
      spec: github-actions-workflow-runs-api-openapi.yml
      confidence: 0.8
    model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: workflowRunsApi
  url: ../openapi/github-actions-workflow-runs-api-openapi.yml
  type: openapi
workflows:
- workflowId: cancel-run
  summary: Cancel a run and confirm it stopped, force-cancelling if necessary.
  description: >-
    Reads the run, requests cancellation, polls until it is no longer in
    progress, and force-cancels when the normal cancel does not take effect.
  inputs:
    type: object
    required:
    - accessToken
    - owner
    - repo
    - runId
    properties:
      accessToken:
        type: string
        description: GitHub bearer token with Actions write access.
      owner:
        type: string
        description: The account owner of the repository.
      repo:
        type: string
        description: The name of the repository without the .git extension.
      runId:
        type: integer
        description: The unique identifier of the workflow run to cancel.
  steps:
  - stepId: getRun
    description: >-
      Fetch the run to confirm it exists and read its current status before
      attempting cancellation.
    operationId: getWorkflowRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: owner
      in: path
      value: $inputs.owner
    - name: repo
      in: path
      value: $inputs.repo
    - name: run_id
      in: path
      value: $inputs.runId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
  - stepId: cancelRun
    description: >-
      Request a normal cancellation of the run. The API returns 202 to
      acknowledge the cancellation request.
    operationId: cancelWorkflowRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: owner
      in: path
      value: $inputs.owner
    - name: repo
      in: path
      value: $inputs.repo
    - name: run_id
      in: path
      value: $inputs.runId
    successCriteria:
    - condition: $statusCode == 202
  - stepId: pollRun
    description: >-
      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.
    operationId: getWorkflowRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: owner
      in: path
      value: $inputs.owner
    - name: repo
      in: path
      value: $inputs.repo
    - name: run_id
      in: path
      value: $inputs.runId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
      conclusion: $response.body#/conclusion
    onSuccess:
    - name: stoppedNormally
      type: end
      criteria:
      - context: $response.body
        condition: $.status == "completed"
        type: jsonpath
    - name: stuckCancelling
      type: goto
      stepId: forceCancelRun
      criteria:
      - context: $response.body
        condition: $.status == "queued"
        type: jsonpath
    - name: stillRunning
      type: goto
      stepId: pollRun
      criteria:
      - context: $response.body
        condition: $.status == "in_progress"
        type: jsonpath
  - stepId: forceCancelRun
    description: >-
      Force cancel the run when the normal cancel request did not take effect.
      The API returns 202 to acknowledge the force cancellation request.
    operationId: forceCancelWorkflowRun
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: owner
      in: path
      value: $inputs.owner
    - name: repo
      in: path
      value: $inputs.repo
    - name: run_id
      in: path
      value: $inputs.runId
    successCriteria:
    - condition: $statusCode == 202
  outputs:
    runId: $inputs.runId
    finalStatus: $steps.pollRun.outputs.status

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/github-actions-cancel-run-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.