Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workflow stuck and not cancellable

I did a misconfiguration with concurrency, initially in the root of my GitHub Actions workflow, and moved to a sub workflow (workflow_call).

Since, I have a workflow that is stuck with label:

enter image description here

I tried to cancel it with gh official CLI, response: gh: Cannot cancel a workflow run that is completed. (HTTP 409)

enter image description here

I also found this other workflow to be stuck, I also tried to cancel it with github api response : {}

enter image description here

Since all my following workflow are stuck.

According to GitHub, it is possible to force cancel a workflow using the API, but this doesn't work.

This is the more detailled force cancel workflow documentation.

How can I force stop a GitHub Actions workflow?

like image 868
Dimitri Kopriwa Avatar asked Mar 05 '26 14:03

Dimitri Kopriwa


1 Answers

EDIT: apologies, I didn't read your original issue properly, you had:

According to GitHub, it is possible to force cancel a workflow using the API, but this doesn't work.

Leaving the rest below for posterity, but clearly this isn't an answer to your q.


If a workflow is stuck, or cannot be canceled for other reasons, there's now a new command (only available through the GH REST API) that forces the cancellation of a workflow: force-cancel.

  • Introduction blog post
  • Official documentation

Using curl

Replace OWNER (or org) and REPO and RUN_ID with your current values.

curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/OWNER/REPO/actions/runs/RUN_ID/force-cancel

Using GH CLI

Replace OWNER (or org) and REPO and RUN_ID with your current values.

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/OWNER/REPO/actions/runs/RUN_ID/force-cancel

EDIT: while this should just work, I currently have a situation where a run cannot be canceled using the front-end, and using this command, will return a 500 error.

Looks like the GitHub team didn't yet completely fix the issue.

like image 136
Abel Avatar answered Mar 08 '26 11:03

Abel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!