Skip to content

Provide a way to force-cancel actions and improve cancellation feedback #1846

Description

@protiumx

Describe the enhancement

  • Provide a way to force-cancel any action run despite its running conditions.
  • Improve feedback in the UI and API when re-evaluating the running conditions did not cancel the action run.

Context
As for today I found myself unable to cancel one action of my workflows.
I understand that due to its setup, the "cancel run" button was not working as I expected.
The conditions that were met:

  • The job has a run condition set to always()
  • The action ran into a dead-lock

To cancel the action, I tried:

  • Use the cancel run in the actions UI.
  • I used gh client as follow
gh run cancel <run_id>

Received

✓ Request to cancel workflow submitted.

Non of the steps above provided information whether the action run was cancelled or not.
Looking through the documentation I found this:

To cancel the workflow run, the server re-evaluates if conditions for all currently running jobs. If the condition evaluates to true, the job will not get canceled. For example, the condition if: always() would evaluate to true and the job continues to run. When there is no condition, that is the equivalent of the condition if: success(), which only runs if the previous step finished successfully.

With this in mind, I think I will have to wait 6 hours for the default time out that jobs have.

Code Snippet
To try this out

name: dead-lock
on:
  workflow_dispatch:
jobs:
  run:
    if: always()
    runs-on: ubuntu-latest
    # force the action to stop
    timeout-minutes: 5
    steps:
        - run: | 
            for i in {0..9999}; do
               sleep 1
            done

Once the action is dispatched try to cancel it
Additional information
Add any other context about the feature here.

NOTE: if the feature request has been agreed upon then the assignee will create an ADR. See docs/adrs/README.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions