cancel-workflow-action icon indicating copy to clipboard operation
cancel-workflow-action copied to clipboard

Optionally wait for cancellation to complete

Open haines opened this issue 5 years ago • 4 comments

The cancel workflow run API returns HTTP 202 Accepted, but the run isn't actually cancelled until some time later.

If I really need two runs not to overlap, I should wait until the cancelled runs have actually stopped before continuing.

I'd like to propose adding something like a wait option (defaulting to false) that polls the state of the cancelled runs and only completes the action once they are no longer in_progress.

haines avatar Jul 10 '20 16:07 haines

If I really need two runs not to overlap

What's the use case here? Doesn't sound like typical CI testing?

styfle avatar Jul 10 '20 16:07 styfle

My workflow has a bot user that approves a related pull request in another repo when the tests in this repo pass, and the first step of the workflow is dismissing any previous approval (which is now stale).

If I don't wait for the cancellation to complete, I have a race condition where the previous build manages to approve the pull request before it gets stopped, and after the latest build has attempted to dismiss the review.

I figured out that I can achieve this by adding https://github.com/softprops/turnstyle immediately after this action, so if you don't think the feature is a good fit here, no worries 🙂

haines avatar Jul 14 '20 08:07 haines

I think another Action is a good workaround, it keeps this Cancel Action simple 😄

I'll keep this issue open if others want to upvote, then we can revisit if its needed 👍

styfle avatar Jul 14 '20 23:07 styfle

What's the use case here? Doesn't sound like typical CI testing?

Sometimes, your testing may be making use of a limited external resource (like, say, a network port, or a piece of hardware). In such a case, you may have a hard limit on the amount of concurrency you can use. These sort of scenarios are perhaps rare in CI, but they are not impossible, depending on the domain.

rburchell avatar Dec 03 '21 15:12 rburchell

It looks pretty rare since there was only one upvote and that use case was solved in #209 now.

So I'll close this as wont fix.

styfle avatar Oct 03 '23 15:10 styfle