actiongh

cancel_workflow_run

Cancels a GitHub Workflow run

Activity as code

Below are the details and signature of the activity Python module.

Typeaction
Modulechaosreliably.activities.gh.actions
Namecancel_workflow_run
Returnmapping

Usage

JSON

{
  "name": "cancel-workflow-run",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosreliably.activities.gh.actions",
    "func": "cancel_workflow_run",
    "arguments": {
      "repo": ""
    }
  }
}

YAML

name: cancel-workflow-run
provider:
  arguments:
    repo: ""
  func: cancel_workflow_run
  module: chaosreliably.activities.gh.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
repostringYesRepository
branchstring“main”NoBranch
at_randombooleanfalseNoPick a Build at RandomPick any run matching the criteria
eventstring“push”NoTriggered EventSelect a run that was triggered by this specific event
statusstring“in_progress”NoRun StatusSelect a run that has this status
windowstring“5d”NoWindowSelect a run within the given time window only
actorstringnullNoActorSelect a run triggered by this actor
workflow_idstringnullNoWorfklow IdentifierSelect a run of this workflow only
workflow_run_idstringnullNoWorfklow Run IdentifierSelect a specific run
exclude_pull_requestsbooleanfalseNoExclude PR RunsExclude PR runs

Cancels a GitHub Workflow run.

The target run is chosen from the list of workflow runs matching the given parameters.

To refine the choice, you can set commit_message_pattern which is a regex matching the commit message that triggered the event.

If you set at_random, a run will be picked from the matching list randomly. otherwise, the first match will be used.

You may also filter down by workflow_id to ensure only runs of a specific workflow are considered.

Finally, if you know the workflow_run_id you may directly target it.

Signature

def cancel_workflow_run(
        repo: str,
        at_random: bool = False,
        commit_message_pattern: Optional[str] = None,
        actor: Optional[str] = None,
        branch: str = 'main',
        event: str = 'push',
        status: str = 'in_progress',
        window: str = '5d',
        workflow_id: Optional[str] = None,
        workflow_run_id: Optional[str] = None,
        exclude_pull_requests: bool = False,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass