Hi! We want to use Github branch protections to ma...
# how-do-i
a
Hi! We want to use Github branch protections to make one of our CI jobs required, and block merge if it's failing. Can you help us work out how best to get this working with the Graphite merge queue? • I'm planning to set up the branch protection rule on our
main
branch • We want mergeability to fail on any PR in a stack where the job fails. However, I think the target branch is only
main
on the bottom PR in the stack, so the job will only be required in that PR, not any higher PRs (is that actually true?) • We're using the merge queue to take advantange of 'merge as stack', so we don't want to have to merge the PRs one-at-a-time, rebasing and re-running CI after each merge • We don't run all our CI in the merge queue because it's slow (and also, we'd like to know if there's an issue at review time, not when the stack goes into the merge queue) - so having the job be required in the merge queue PR only is not sufficient. Is there a setup that will work for us? Thanks in advance!
p
(If applicable) To help us more clearly understand what you're trying to do, please provide additional details about: - Screenshots / debug logs / list of commands you've tried to run so far - Your workflow - Current state
a
We don't have standard branch naming conventions - we really want this job to be required on all branches, excluding some matching a pattern
Maybe Github rulesets instead of branch protections would be a reasonable option
I've just found https://graphite.dev/docs/github-configuration-guidelines#branch-protection-rules - specifically "Graphite projects branch protection rules from the base of the stack (the branch that everything is merging into)." Does that mean that if we have a branch protection rule targeting 'main', it will apply to all PRs in a stack based on 'main'?
p
Hey Anna, i can see that line being a bit confusing. My colleague actually just updated this page which goes into more detail on targeting all branches upstack of trunk. Check it out here. Also worth nothing, depending on your merge queue settings, you may want to look at the draft prs which use the prefix:
gtmq_
. More docs on that here.
a
Thank you!