mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
[ez] Fix check labels error when deleting comment (#140578)
Re make of https://github.com/pytorch/pytorch/pull/140587 Pull Request resolved: https://github.com/pytorch/pytorch/pull/140578 Approved by: https://github.com/huydhn
This commit is contained in:
parent
274f4cfacb
commit
08acfcddc4
6
.github/scripts/check_labels.py
vendored
6
.github/scripts/check_labels.py
vendored
|
|
@ -45,15 +45,15 @@ def main() -> None:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not has_required_labels(pr):
|
if not has_required_labels(pr):
|
||||||
print(LABEL_ERR_MSG)
|
print(LABEL_ERR_MSG, flush=True)
|
||||||
add_label_err_comment(pr)
|
add_label_err_comment(pr)
|
||||||
if args.exit_non_zero:
|
if args.exit_non_zero:
|
||||||
sys.exit(1)
|
raise RuntimeError("PR does not have required labels")
|
||||||
else:
|
else:
|
||||||
delete_all_label_err_comments(pr)
|
delete_all_label_err_comments(pr)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if args.exit_non_zero:
|
if args.exit_non_zero:
|
||||||
sys.exit(1)
|
raise RuntimeError(f"Error checking labels: {e}") from e
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
|
||||||
6
.github/scripts/github_utils.py
vendored
6
.github/scripts/github_utils.py
vendored
|
|
@ -73,10 +73,10 @@ def gh_fetch_url(
|
||||||
headers: Optional[Dict[str, str]] = None,
|
headers: Optional[Dict[str, str]] = None,
|
||||||
data: Union[Optional[Dict[str, Any]], str] = None,
|
data: Union[Optional[Dict[str, Any]], str] = None,
|
||||||
method: Optional[str] = None,
|
method: Optional[str] = None,
|
||||||
reader: Callable[[Any], Any] = lambda x: x.read(),
|
reader: Callable[[Any], Any] = json.load,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
return gh_fetch_url_and_headers(
|
return gh_fetch_url_and_headers(
|
||||||
url, headers=headers, data=data, reader=json.load, method=method
|
url, headers=headers, data=data, reader=reader, method=method
|
||||||
)[1]
|
)[1]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ def gh_close_pr(org: str, repo: str, pr_num: int, dry_run: bool = False) -> None
|
||||||
|
|
||||||
def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:
|
def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:
|
||||||
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"
|
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"
|
||||||
gh_fetch_url(url, method="DELETE")
|
gh_fetch_url(url, method="DELETE", reader=lambda x: x.read())
|
||||||
|
|
||||||
|
|
||||||
def gh_fetch_merge_base(org: str, repo: str, base: str, head: str) -> str:
|
def gh_fetch_merge_base(org: str, repo: str, base: str, head: str) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user