-
Notifications
You must be signed in to change notification settings - Fork 699
Script to ghstack land #6270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script to ghstack land #6270
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6270
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 3410698 with merge base 7510f8c ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
3319497 to
5d7fb0b
Compare
12571c1 to
e92bf31
Compare
.github/workflows/ghstack_land.yml
Outdated
|
|
||
| python .github/scripts/propose_ghstack_orig_pr.py --pr $PR_NUMBER --repo pytorch/executorch | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huydhn could use your help with getting a bot token for creating the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huydhn Then let's still use GH_PYTORCHBOT_CHERRY_PICK_TOKEN, and add environment: cherry-pick-bot?
.github/workflows/ghstack_land.yml
Outdated
| name: Propose to merge ghstack orig PRs to main | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, closed] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cheap job.
|
I need to sit down to review this one, but let me ask @kit1980 to take a look too as granting pull request write permission to a |
Thank you! It’s very similar to our cherry pick bot. However if I use cherry pick bot token it doesn’t allow me to create PR (maybe on this branch trigger). GH actions token can’t be used to create PR. |
|
@kit1980 Let me hear what you think. From what I see, we could make the PR work as it stands because it only needs to grant write permission to ghstack PRs. And folks need to have write permission to the repo already to be able to use ghstack in the first place. So, there shouldn't be any security gap (if we implement the workflow correctly) |
e92bf31 to
b0f1d52
Compare
|
|
||
| python .github/scripts/propose_ghstack_orig_pr.py --pr $PR_NUMBER --repo pytorch/executorch | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the issue. Secrets are not passed to forked PRs on |
.github/workflows/ghstack_land.yml
Outdated
| pull_request: | ||
| types: [opened, synchronize, closed] | ||
| branches: | ||
| - 'gh/*/[0-9]+/base' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you want to choose a smaller group of people to test this out first, you can list them here explicitly, i.e.
branches:
- 'gh/kirklandsign/[0-9]+/base'
- 'gh/guangy10/[0-9]+/base'
It seems like a good idea to try it out first before rolling out to everyone.
c88dcc0 to
0734fc6
Compare
0734fc6 to
3410698
Compare
|
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| parser.add_argument( | ||
| "--pr", | ||
| type=int, | ||
| help="Number of the PR in the stack to check and create corresponding PR", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify this? Is this an index into the stack, or the PR number itself? And if it's an existing PR, why does it need to create another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@kirklandsign merged this pull request in 18a7e65. |
Now it's in a good shape, let's expand it to everyone. Original discussion: #6270 (comment)
Now it's in a good shape, let's expand it to everyone. Pull Request resolved: #7092 Original discussion: #6270 (comment)
Per ghstack tutorial for a PR exported by ghstack, it will have two diff sets:
gh/user/1/base <- gh/user/1/headwhere the PR is created like thismain <- gh/user/1/origThe purpose of this bot is, when the ghstack PR is merged, automatically create another PR to do this merge
main <- gh/user/1/orig. Then we just merge the newly created PR so thatmainhas that change.Missing piece: token from pytorch bot to create PR.
If this goes well, we can either
git mergethe commit from gh/user/1/orig into main directly, without going through the new PR; or auto approve and merge the PR.Test: You can test locally with
export GITHUB_TOKEN=ghpxyz; python .github/scripts/propose_ghstack_orig_pr.py --pr 6265 --repo pytorch/executorchNote that between /orig merges, there is never a merge conflict.
The invariant is guaranteed that gh/user/1/orig contains the exact same change between
gh/user/1/base <- gh/user/1/headby ghstack tool.