hi, I’m using GitHub actions to run CI jobs on the pull request. When the pull request is updated (e.g. new commits pushed), the new CI job is triggered, however previous jobs will continue to run which is not necessary. It is often annoying because a failed result mail may be sent to me. What I only care about is whether the HEAD of this pull request is ok to merge.
It’s not supported. Previous CI job is executed in a different github runner, it’s separated with the new CI job.
What about local Action Runners?
There’s a related question here: https://github.community/t5/GitHub-Actions/Github-actions-Cancel-redundant-builds/td-p/29549
We don’t have this exact feature, but we did just release an API that allows you to cancel builds.
I’m imagining something could be scripted to do this.
I almost forgot to post my solution: I created a GitHub Action to cancel previous running workflows.
I created another solution that solves this problem: https://github.com/marketplace/actions/skip-duplicate-actions
Other than cancelling previous jobs, it also prevents duplicate jobs after merges, pull requests or similar.