Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Run CI only for the base of a stack of PRs (#81098)

Nemanja Glumacd35b91c92c76
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 10e27f04898..b508e7888a7 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -20,6 +20,10 @@ permissions:
jobs:
# `force-run` and `force-skip` are global overrides; `defer` means this
# job has no opinion and every downstream gate behaves as it always has.
+ #
+ # Only the lowest unmerged PR of a stack runs CI: it is the one whose base
+ # ref is the stack base. Every PR above it is force-skipped and gets tested
+ # once it reaches the bottom of the stack.
should-run:
name: Decide which jobs should run
runs-on: ${{ vars.SLIM_RUNNER_KEY }}
@@ -35,6 +39,7 @@ jobs:
${{ (github.ref_name == 'master' || startsWith(github.ref_name, 'release-x.')) && 'force-run'
|| contains(github.event.pull_request.labels.*.name, 'ci:run-all') && 'force-run'
|| contains(github.event.pull_request.labels.*.name, 'ci:skip') && 'force-skip'
+ || (github.event.pull_request.stack != null && github.event.pull_request.stack.base.ref != github.event.pull_request.base.ref) && 'force-skip'
|| 'defer' }}
run: echo "verdict=$VERDICT" | tee -a "$GITHUB_OUTPUT"