Commit Graph

226 Commits

Author SHA1 Message Date
6a81e68e4a [GHF] Add ability to specify team as the approver
All GitHub teams belong to organization, and therefore must be
referenced as `org/team_name`

Add memoizable `gh_get_team_members` and tests that it can be used to
query existing and non-existing teams

Note: Requires "org.read" permission on the token to work function

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74892

Approved by: https://github.com/janeyx99
2022-03-29 19:11:21 +00:00
ddf8ffa15b [GHF] Fix force merge handling
Pass `force` argument into `GitHub.merge_into`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74886

Approved by: https://github.com/seemethere
2022-03-29 16:05:43 +00:00
f36ceefd71 [GHF] Speedup default PR query
Fetch check run statuses only last commit and authors names for first
hundred

This avoids hitting the resource limits on PR with lots of commits
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74731
Approved by: https://github.com/seemethere
2022-03-25 18:12:29 +00:00
d7a857b0c0 [GHF] Pass message id to revert command
This prevents race condition when somebody posts new comment before
revert is processed

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74587

Approved by: https://github.com/janeyx99
2022-03-24 00:42:35 +00:00
903dd87eb7 [GHF] Add option to fetch all comments for PR
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74552

Approved by: https://github.com/seemethere
2022-03-23 17:27:04 +00:00
075a633359 [GHF] Add --force option
That allows to skip all mandatory checks but CLA

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74551

Approved by: https://github.com/seemethere
2022-03-23 17:27:04 +00:00
ca500f32da [GHF] Add test for GitHubPR.get_last_comment
Also, fix regression/typo introduced by https://github.com/pytorch/pytorch/pull/74549

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74570

Approved by: https://github.com/seemethere
2022-03-22 19:07:29 +00:00
1f12f26f7f [GHF] Force dry-run to be passed as named argument
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74550

Approved by: https://github.com/seemethere
2022-03-22 18:16:02 +00:00
e4beaadc36 [GHF] Refactor comment fetching logic
`get_comment_[body|author|editor|author_association]` -> `get_comment`
returning a `GitHubComment` dataclass

Pull Request resolved: https://github.com/pytorch/pytorch/pull/74549

Approved by: https://github.com/seemethere
2022-03-22 18:16:02 +00:00
f9a63d0a97 Implement checksuites pagination
Do not increase default number of checkruns as 100(max number of commits)x100(max number of checkruns) items can push query over GraphQL limit on total number of returned items.
- Add logic to implement pagination to `get_conclusions` query
- Add test to validate that pagination works

Fixes: https://github.com/pytorch/test-infra/issues/253
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74251
Approved by: https://github.com/bigfootjon, https://github.com/seemethere
2022-03-15 21:13:53 +00:00
6eb94f16c7 [GH1] Refuse to merge PRs with internal changes
If PR has associated differential revision, and "Meta Internal-Only Changes Check" status is not successful, it must be merged via Phabricator rather than GH Workflow.

Add test to validate this workflow
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73630
Approved by: https://github.com/seemethere
2022-03-10 18:13:13 +00:00
f71eede85a [GHF] Specify multiple mandatory checks
Replace `mandatory_app_id` with `mandatory_checks_name`
Make `Facebook CLA Check` mandatory for all merge rules

Pull Request resolved: https://github.com/pytorch/pytorch/pull/73976

Approved by: https://github.com/bigfootjon, https://github.com/seemethere
2022-03-09 21:27:10 +00:00
63a1e7bd09 Revert "Check that PR base is default branch in trymerge.py"
This reverts commit dc38326f1d66762586c7610cd03c94e5bd031908.

Reverted https://github.com/pytorch/pytorch/pull/73715 on behalf of https://github.com/malfet
2022-03-09 19:41:27 +00:00
dc38326f1d Check that PR base is default branch in trymerge.py
I've verified this locally with dry run.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73715
Approved by: https://github.com/malfet
2022-03-09 00:11:26 +00:00
0b79715d49 GHF: Add clickable links for Approved By
Adds clickable links within the Github UI for Approve By messages with
Github First merges

Signed-off-by: Eli Uriegas <eliuriegasfb.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/73677

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Approved by: malfet
2022-03-03 22:58:49 +00:00
d7682d31f9 [GH1] Append "Reviewed by:" to commit message
As reviewers can change when PR is reopened for example

Pull Request resolved: https://github.com/pytorch/pytorch/pull/73633
2022-03-02 18:29:40 +00:00
ec49373044 [GH1] Support merging PRs with more than 100 files
Implement pagination in `GitHubPR.get_changed_files()` and add test for
that

Pull Request resolved: https://github.com/pytorch/pytorch/pull/73317
2022-02-24 01:27:26 +00:00
6688487f3e Fix get_author detection
In some cases commit->author node can be null, if user is not GitHub
user

Add tests that use mock instead of querying github every time
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73296
2022-02-23 19:00:33 +00:00
ef92b5490b [GH1] Ignore "COMMENTED" reviews
Do not use `lastestReviews` as indicator as to whether PR was reviewed
or not, as "COMMENTED" PRs take precedence over "APPROVED"
Instead, iterate over all reviews, which are in chronological order
(newest one are at the bottom) and keep latest review from the author
ignoring "COMMENTED" ones

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72751
2022-02-11 23:01:46 +00:00
0c95209fe7 [GH1] Enable cross-repo merges
GHStack based PRs still can not be cross-repo, but for regular ones
checkout `pull/{pr_no}/head`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72750
2022-02-11 22:49:47 +00:00
3b9f2e2cca [GHF] More verbose failures messages (#71941)
Summary:
Modify _check_output to capture `CalledProcessError` and add
stdout/stderr to the failure message
Also record github actions run id in the failure message (calculated based on `${{ github.run_id}}`)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71941

Reviewed By: seemethere

Differential Revision: D33829633

Pulled By: malfet

fbshipit-source-id: 060b2856ca6c71574075effa72b982f9e1d64e6e
(cherry picked from commit a9ad7df9b540f9ab14524a644cab5e06225debe4)
2022-01-27 23:49:58 +00:00
5bd33247ec [GHF] Add revert workflow
This adds `try_revert` repository dispatch that will revert commit
that were previously landed by merge workflow if requested by org member

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71868
2022-01-26 22:35:02 +00:00
d73dc9b7d1 [GHF] Small cleanups
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71867
2022-01-26 22:08:10 +00:00
9adee84a3f .github: Improve syncbranch debugability (#71596)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71596

Adds a dry_run to test out push as well as adding in a debug flag to
allow you to see what git commands are running

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Test Plan: Imported from OSS

Reviewed By: malfet, bigfootjon

Differential Revision: D33695224

Pulled By: seemethere

fbshipit-source-id: 03bf6a3f2d9594089e134d95c3d35a6779ba7a26
(cherry picked from commit a75a402f9d02d5e4c709e25ca385264f854945d1)
2022-01-20 23:53:02 +00:00
0df607ce00 Separate title and body of commit by 2 lines (#71598)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/71598

Reviewed By: seemethere

Differential Revision: D33696070

Pulled By: malfet

fbshipit-source-id: 8508c548279658f7d751b4c064b0d0c5053b7660
(cherry picked from commit 5c679f2bea5c3b4df7292cd40ebe2a804efbf854)
2022-01-20 23:42:42 +00:00
61713acb07 Add trymerge workflow (#71488)
Summary:
This one, will react to `repo_dispatch` event sent by PyTorch Probot
when `pytorchbot merge this` command is issued

At the moment, workflow will only attempt to merge PRs which has not
been created from forked repo and that match rules defined in
`.github/merge_rules.json`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71488

Reviewed By: bigfootjon

Differential Revision: D33665142

Pulled By: malfet

fbshipit-source-id: e22daa1892523e62d7b7a941960636a6514cb7d7
(cherry picked from commit 92059bab073e2cd6ca6e9f946ffc2f956e22895c)
2022-01-19 23:11:48 +00:00