First-class support for stacked PRs in Github Actions #356
Answered
by
skarim
jasondamour
asked this question in
Q&A
|
Hello, We'd like to skip triggering CI on Stacked PRs, since CI will be re-triggered when base branches are updated and we want to save cost. However, we want to keep CI enabled for other PRs targeting non-default branches. Is there anything in the Github Actions trigger payload we can use to determine if a PR trigger is stacked? Will there be first-class triggers for stack events? Thank you |
Answered by
skarim
Jul 30, 2026
Replies: 1 comment 1 reply
|
Yes and yes! There is a jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run for the lowest unmerged PR in the stack
if: github.event.pull_request.stack.base.ref == github.event.pull_request.base.ref
run: echo "Lowest unmerged PR in the stack"
- name: Run for the top PR in the stack
if: github.event.pull_request.stack != null && github.event.pull_request.stack.position == github.event.pull_request.stack.size
run: echo "Top PR in the stack" |
1 reply
Answer selected by
skarim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes and yes! There is a
stackobject included in allpull_requestwebhook events. And there is a newstackedevent that fires when a PR is added to a stack. More on this here: https://github.github.com/gh-stack/reference/webhooks/