Canceling Slim CI jobs if a new PR is made on the same codebase or if a new commit is made to a PR using Github Actions

I noticed some dbt Cloud users wanted a way to cancel running CI jobs when a new PR is opened against the same code base in order to always have the latest PR changes running without having to wait for stale ones to finish.

I created a Github Action that checks if a dbt cloud CI job (based on job ID) is running after a new or updated PR commit is made. If there is a job running or there are job runs that are queued - this action will cancel these running and queued runs since they are likely stale as a new commit to the PR has been made. This allows to always have the newest code commit running in the CI job without having to wait for the stale job runs to finish.

Loom video on using this Github Action can be found HERE

1 Like

This is really cool! I love that the actions page also has a bunch of example workflows, including interactions with other actions :star-struck:

Note: @joellabes (dbt Labs) originally posted this reply in Slack. It might not have transferred perfectly.

You are my personal hero.

1 Like