Xuehai Pan
747b38c131
[BE][Easy][2/19] enforce style for empty lines in import segments in .ci/ and .github/ ( #129753 )
...
See https://github.com/pytorch/pytorch/pull/129751#issue-2380881501 . Most changes are auto-generated by linter.
You can review these PRs via:
```bash
git diff --ignore-all-space --ignore-blank-lines HEAD~1
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129753
Approved by: https://github.com/malfet
ghstack dependencies: #129752
2024-07-16 09:40:00 +00:00
Catherine Lee
02a411d4a6
[mergebot] Dry run for labels + easier to read Dr CI result ( #118240 )
...
Dry run open for labels so we can run trymerge locally with dryrun without actually affected the PR
Make Dr.CI results easier to read (previously a massive json dump, now just the job names + ids, in a nicer format)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/118240
Approved by: https://github.com/huydhn
2024-01-25 23:06:43 +00:00
Nikita Shulga
87da0e1d23
[GHF] Fix gh_get_labels for small repos ( #116444 )
...
Not sure if this is recent API change or what but `gh_get_labels('malfet', 'deleteme')` used to raise an exception (see https://github.com/malfet/deleteme/actions/runs/7334535266/job/19971328673#step:6:37 )
```
File "/home/runner/work/deleteme/deleteme/.github/scripts/label_utils.py", line 50, in get_last_page_num_from_header
link_info[link_info.rindex(prefix) + len(prefix) : link_info.rindex(suffix)]
AttributeError: 'NoneType' object has no attribute 'rindex'
```
And with this fix it returns the expected list
Pull Request resolved: https://github.com/pytorch/pytorch/pull/116444
Approved by: https://github.com/huydhn
2023-12-27 15:50:42 +00:00
Justin Chu
14d87bb5ff
[BE] Enable ruff's UP rules and autoformat tools and scripts ( #105428 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105428
Approved by: https://github.com/albanD , https://github.com/soulitzer , https://github.com/malfet
2023-07-19 01:24:44 +00:00
Nikita Shulga
7b5f8988a2
[GHF] Auth when trying to fetch labels ( #103679 )
...
There were few merge bot failures reported recently due to HTTP/403 error:
- https://github.com/pytorch/pytorch/actions/runs/5269083146/jobs/9526693976#step:6:80
- https://github.com/pytorch/pytorch/actions/runs/5272750075/jobs/9535376256#step:6:93
Which likely stems from the fact that `_fetch_url` method did not try to pass the auth token even when it was available and as result was rate-limited to 60 requests per hour, according to [Resources in the REST API](https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limit-headers )
Refactor `gh_fetch_url` into `gh_fetch_url_and_headers` and use it from `request_for_labels` to utilize auth token, if available, which bumps rate limit to 1000 per hour as well as print more actionable message when rate limit is exceeded.
<!--
copilot:poem
-->
### <samp>🤖 Generated by Copilot at 499b805</samp>
> _`gh_fetch_url` splits_
> _returns headers and body_
> _wrapper function_
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103679
Approved by: https://github.com/jeanschmidt , https://github.com/kit1980
2023-06-15 17:03:55 +00:00
Sergii Dymchenko
b07e97c084
Fix finding existing Needs label comments ( #101889 )
...
After https://github.com/pytorch/pytorch/pull/101747
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101889
Approved by: https://github.com/izaitsevfb , https://github.com/malfet , https://github.com/zou3519
2023-05-19 22:43:53 +00:00
Sergii Dymchenko
a33ac44540
Better needs label error message ( #101747 )
...
As suggested in https://github.com/pytorch/pytorch/issues/101694
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101747
Approved by: https://github.com/malfet , https://github.com/zou3519
2023-05-18 18:27:13 +00:00
PaliC
d06662fb57
Add ephemeral merging label ( #98543 )
...
Addresses https://github.com/pytorch/test-infra/issues/3950
Test Plan: Ran a dry run on this pr. The label showed up while trying to merge
<img width="354" alt="Screenshot 2023-04-06 at 4 57 48 PM" src="https://user-images.githubusercontent.com/13758638/230514276-1ac70b58-d2d1-4e4b-892b-a957bf156063.png ">
And then disappeared after failing
<img width="373" alt="Screenshot 2023-04-06 at 5 00 11 PM" src="https://user-images.githubusercontent.com/13758638/230514470-38b15ec7-cfd9-4efe-b6e8-0f9af5577c62.png ">
There's also the trail of adding and removing the "merging" label at the bottom
Notes: This is slightly buggy sometimes. For example when the merge failed when I was editing this textbox, the label did not disappear.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98543
Approved by: https://github.com/malfet
2023-04-07 08:24:54 +00:00
Huy Do
4c0dce50fd
[BE] Apply ufmt to run_test and GitHub Python util scripts ( #97588 )
...
This has been bugging me for a while as I'm working on these Python scripts and they are not tracked by ufmt linter. So I add these script into that linter.
```
[[linter]]
code = 'UFMT'
include_patterns = [
'.github/**/*.py',
'test/run_test.py',
```
This change should just work and not break anything as ufmt (black + usort) linter is very safe to use for standalone util scripts.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97588
Approved by: https://github.com/kit1980
2023-03-26 04:52:55 +00:00
Sergii Dymchenko
1e4e256790
Mention pytorchbot command on label error ( #97267 )
...
It's not clear how to add a label, especially for contributors without write permissions - they don't have a UI for that.
One recent struggle example - https://github.com/pytorch/pytorch/pull/94671
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97267
Approved by: https://github.com/PaliC , https://github.com/malfet , https://github.com/seemethere
2023-03-22 02:13:14 +00:00
Ning Xu
88e554b513
Move label check failure to mergebot ( #94707 )
...
Fixes https://github.com/pytorch/pytorch/issues/88098
This is a mirror of the same PR (https://github.com/Goldspear/pytorch/pull/3 ) that has been reviewed in my fork (due to it's a stacked PR).
==============
## Context
This the 3rd of the 3 PRs to address the issue 88098.
## What Changed
1. check_labels.py no longer fails, but only leaving a comment
2. trymerge.py now would fail if no required labels provided
## Tests
* dummy-repo trymerge run [fails without required label](https://github.com/Goldspear/pytorch-dummy/actions/runs/4162819216 ) and resulted in [a label error comment](https://github.com/Goldspear/pytorch-dummy/pull/3#issuecomment-1427756769 )
* the above pr was [correctly merged](https://github.com/Goldspear/pytorch-dummy/pull/3 ) after label is added.
## Note to Reviewers
1st PR: https://github.com/pytorch/pytorch/pull/94179
2nd PR: https://github.com/pytorch/pytorch/pull/94899
3rd PR: this one
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94707
Approved by: https://github.com/ZainRizvi
2023-03-03 15:09:14 +00:00
Ning Xu
5ba4dafccd
Retry Merge: extract utils from check labels ptr ( #94899 )
...
Fixes #88098
This is the rebased and retry merging branch of the reverted PR: https://github.com/pytorch/pytorch/pull/94597
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94899
Approved by: https://github.com/kit1980
2023-03-01 20:40:30 +00:00
PyTorch MergeBot
7c3fc2c7f0
Revert "Issue-88098: extract utils from check labels ( #94597 )"
...
This reverts commit 2c76838d7f .
Reverted https://github.com/pytorch/pytorch/pull/94597 on behalf of https://github.com/jeanschmidt due to reverting due internal breakages https://fburl.com/sandcastle/3ukij9xp
2023-02-13 20:19:50 +00:00
Ning Xu
2c76838d7f
Issue-88098: extract utils from check labels ( #94597 )
...
Fixes #88098
This is a mirror of the same PR (https://github.com/Goldspear/pytorch/pull/2 ) that has been reviewed in my fork (due to it's a stacked PR).
======================
## Context
This is the 2nd of the 3 PRs to address issue-88098.
## What Changed
1. Extract comment related utils from trymerge.py to github_utils.py
2. Extract label related utils from trymerge.py and check_labels.py to label_utils.py
## Tests
* pytorch-dummy repo [trymerge run ](https://github.com/Goldspear/pytorch-dummy/actions/runs/4118944174 )merged the test PR [OK](https://github.com/Goldspear/pytorch-dummy/pull/2 ).
## Note to Reviewers
Due to higher degree of complexity involved to extract GitHubPR class, it's worth having a separate issue to handle that part of refactoring. This issue only focusing on refactoring where necessary to ship the functional diff.
* 1st PR: https://github.com/pytorch/pytorch/pull/94179
* 2nd PR: this one
* 3rd PR: https://github.com/Goldspear/pytorch/pull/3
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94597
Approved by: https://github.com/ZainRizvi
2023-02-12 12:18:53 +00:00
Ning Xu
527b646f4b
Refactor to extract label_utils from export_pytorch_labels ( #94179 )
...
Part of fixing #88098
## Context
This is 1/3 PRs to address issue 88098 (move label check failure logic from `check_labels.py` workflow to `trymerge.py` mergebot. Due to the messy cross-script imports and potential circular dependencies, it requires some refactoring to the scripts before, the functional PR can be cleanly implemented.
## What Changed
1. Extract extracts label utils fcns to a `label_utils.py` module from the `export_pytorch_labels.py` script.
2. Small improvements to naming, interface and test coverage
## Note to Reviewers
This series of PRs is to replace the original PR https://github.com/pytorch/pytorch/pull/92682 to make the changes more modular and easier to review.
* 1st PR: this one
* 2nd PR: https://github.com/Goldspear/pytorch/pull/2
* 3rd PR: https://github.com/Goldspear/pytorch/pull/3
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94179
Approved by: https://github.com/ZainRizvi
2023-02-09 19:17:05 +00:00