How to cancel a job from a step? #67407
Replies: 2 comments 1 reply
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Agreed, it would be useful to be able to cancel an individual job, instead of just having a button for the whole workflow run. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I found how to cancel the whole workflow. What I'm looking for is how to cancel a single job within a workflow and keep others running.
I know how to fail the job, with a step:
- run: exit 1
, I'm looking for the equivalent which results incancelled()
being true for the rest of the job's steps.Note: I would be ok with
skipped()
as well.Essentially a coding equivalent would be an early return:
I know of two workarounds, but they have serious drawbacks that make them infeasible to use IRL:
if: !condition
to all further steps: this is maintenance hell, I don't want the rest of the workflow to know that those steps could be cancelled by an earlier step. It breaks so many principles of code.needs:
, this creates noise in the workflow and on PRs because of an implementation detail. It's confusing and unnecessary to make things visible. All I want is 1 cancelled job, and everything else stays the same.Is all hope lost on actions/runner#662 ?
Beta Was this translation helpful? Give feedback.
All reactions