-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Fix mergeability check for ghstack PRs #118258
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/118258
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 38636cf with merge base b10b082 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
e60bd69 to
026aab8
Compare
… PR locally, using the same rules as the mergebot * change mergeability workflow to utilize the new --check-mergeability logic
026aab8 to
2aab17d
Compare
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.
Some naming nits, but otherwise lgtm
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
| gh_remove_label( | ||
| org, project, args.pr_num, MERGE_IN_PROGRESS_LABEL, args.dry_run | ||
| ) | ||
| if not args.check_mergeability: |
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.
From what I see, it would always reach this part with not args.check_mergeability, so the if statement is kind of redundant?
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.
Good catch. For some reason I thought the try block starts earlier.
| # and check if the following files were changed: | ||
| # .github/workflows/check_mergeability_ghstack.yml | ||
| # .github/scripts/trymerge.py | ||
| FILES_CHANGED=$(curl -s -H "Authorization: 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.
This looks fine, but in case you need more complex logic (in bash :P), there are many GHA ready made to get the list of change files in a PR, i.e. https://github.com/tj-actions/changed-files
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 already tried that action :)
Its description is a bit confusing, what it actually does, is checking the locally modified files, rather than the changest of the PR.
| pr.merge_changes( | ||
| repo, | ||
| branch="main", | ||
| skip_mandatory_checks=True, |
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.
Nit: IMO, having 2 params called skip_mandatory_checks and skip_all_rule_checks is a bit weird as the latter's name implies that it subsumes the former. For example, in this call, setting skip_mandatory_checks to True or False doesn't matter. I don't want it to give the impression that skip_all_rule_checks is an option to bring in a bigger force merge hammer. It's more like a different kind of --dry-run like what you call out in the description. So, may be a different name is more apt, i.e. check_mergability_mode
…st (#4907) In pytorch/pytorch#118258 mergeability check job was renamed to `ghstack-mergeability-check`. This PR updates flakiness exclusion accordingly.
| get_ghstack_prs(repo, pr) # raises error if out of sync | ||
| pr.merge_changes( | ||
| repo, | ||
| branch="main", |
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.
Please please please don't hardcode default branch name, as pr has get_default_branch() property
Changes
--check-mergeabilitytrymerge flag that attempts to merge PR locally, using the same merge logic as the mergebot, but requires just a read-onlyGITHUB_TOKENand git repo.Alternatives considered
That would be a slightly better approach, but ROI is lower, as it requires reimplementing trymerge logic and additional effort to consolidate the codebase (trymerge lives in pytorch repo).
pr-dependencies-check.ymlstill produces human-readable results for partially merged ghstack prs (even if it falsely reports them as non-mergeable).That didn't work, as no combination of existing flags skips the rule checks and ROCKSET lookups.
Testing
trymerge.py --check-mergeabilityon the regular and ghstack PRs:https://github.com/pytorch/pytorch/actions/runs/7660736172/job/20878651852?pr=118258