I'm trying to set up my GitHub Actions workflow and I want to ensure that one specific job, the deploy job, continues to run even if the main workflow is canceled. Currently, I have configured my action like this: at the root level, I have a concurrency setting that cancels in-progress jobs, and for the deploy job, I've set it to not cancel in progress. However, it still gets canceled when a new workflow triggers in the same group. Is there a way to truly make the deploy job non-cancelable, or do I need to take a different approach?
2 Answers
Unfortunately, it looks like there’s no way to make a job keep running after the main workflow is canceled. A common workaround is to put that job into its own workflow and then trigger it from your main workflow using workflow dispatch. This way, the deploy job can keep running even if the workflow that triggered it gets canceled. You might want to consider this approach!
I found out that if you remove the concurrency setting from the workflow itself and apply it to the individual jobs, it can work! Might be worth trying!
I’d suggest double-checking your concurrency settings. Sometimes, small mistakes in the configuration can lead to behaviors like the one you're experiencing. If you need the deploy job to run uninterrupted, consider completely separating it out as a different workflow.
That’s a cool workaround! I set up my repository with Cloud Run, and now I have automatic builds and deployments for every push. It’s super convenient for CI/CD!