Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

add input param to run endless sleep after cancel #12

Open
copdips opened this issue Oct 3, 2023 · 2 comments
Open

add input param to run endless sleep after cancel #12

copdips opened this issue Oct 3, 2023 · 2 comments

Comments

@copdips
Copy link

copdips commented Oct 3, 2023

Hello,

As this action triggers an asynchronous cancel to current running workflow, is it possible to add an additional input that users can ask this action to run a endless sleep until the workflow is cancelled.

Currently, I achieved this by adding an additional bash workflow step sth. like:

- name: sleep after cancel
  run: |
    while true ; do sleep 1 ; done
  shell: bash

It would be nice if this action could include this automatically

@copdips copdips changed the title add input to run sleep in seconds after cancel add input param to run endless sleep after cancel Oct 3, 2023
@andymckay
Copy link
Owner

I'd be a little worried about anything going into a sleep and potentially consuming minutes this way. Maybe polling the Actions API and waiting for it to report cancelled might be better? If it doesn't reply as cancelled with 10 minutes, then give up and fail.

Alternatively, we could just add an "exit immediately" after sending the cancel API request I believe?

@copdips
Copy link
Author

copdips commented Jan 30, 2024

I asked for the sleep time is in case of a conditional cancel-action, say sth like below:

steps:
 - run: create a var named test
 - name: cancelling
   if: test is true
   uses: andymckay/cancel-action@0.3
 - run: continue if not cancelled

Without the sleep step, the next step run: continue if not cancelled will be triggered every time. regardless of whether the if condition is true or false, which is unexpected.

yes, an additional sleep with timeout (given as action input) is a good idea I think.

I'm not sure if an immediate exit is suitable or if it's easy to implement as we need to cancel the whole workflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants