Github: stack PR workflow and prevent merging stack into one another #343
OlivierLDff
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm using stack PR workflow for github.
I have the assle of manually choosing the base branch in github, I don't have anything to help with that yet.
I want to share a simple action I added that fix a big pain-point in the workflow: Merging a PR into another. Often a coworker would review my stack into the wrong order, and I would see a big green ready to merge button. If not paying attention that the PR base branch isn't
main
, I could merge a PR into another branch, creating a mess, and not clean commit history inmain
.So here I present to you an action that will prevent you from merging by making the CI failing and adding a
🗄️ stacked
label to the PR automatically.Example:

As you can see the label is automatically added and removed from the PR.
Then on my first PR targeting


main
:And the subsequent one:
Have a nice day, I hope this action could help someone in their workflow, and whatnot if someone has improvement
EDIT:
CLI workflow
I found some nice CLI tricks to ease the workflow.
Create the PR on github based on the correct branch:
gh pr create --base $(git stack --format list --stack current | tail -n 2 | head -n 1) --fill
Force push all branchs of a stack:
git push origin $(git stack --format list --stack all) --force
Beta Was this translation helpful? Give feedback.
All reactions