mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[BE] Runner determinator: Expect usernames to be prefixed with '@' (#129246)
Expect the username in the runner rollover issue (https://github.com/pytorch/test-infra/issues/5132) to be prefixed with a "@". This will make typos way less likely since github's autocomplete/autoformating will help out For now, I've updated the issue to have usernames both with and without the @ while this change rolls out Testing: Ran the script locally on both this issue and a new test issue and verified they both had the expected output: ``` (venv) (base) ➜ ~/pytorch git:(zainr/improve-get-workflow-type) python .github/scripts/get_workflow_type.py --github-token github_pat_*** --github-issue 5132 --github-user ZainRizvi --github-branch "zainr/stuff" {"label_type": "lf.", "message": "LF Workflows are enabled for ZainRizvi. Using LF runners."} ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/129246 Approved by: https://github.com/zxiiro, https://github.com/huydhn
This commit is contained in:
parent
533395e204
commit
4d04203852
2 changed files with 10 additions and 2 deletions
6
.github/scripts/get_workflow_type.py
vendored
6
.github/scripts/get_workflow_type.py
vendored
|
|
@ -51,6 +51,10 @@ def is_exception_branch(branch: str) -> bool:
|
|||
|
||||
|
||||
def get_workflow_type(issue: Issue, username: str) -> Tuple[str, str]:
|
||||
formatted_username = (
|
||||
f"@{username}" # Add the @ symbol to match the format in the issue body
|
||||
)
|
||||
|
||||
try:
|
||||
user_list = issue.get_comments()[0].body.split()
|
||||
|
||||
|
|
@ -60,7 +64,7 @@ def get_workflow_type(issue: Issue, username: str) -> Tuple[str, str]:
|
|||
elif user_list[0] == "*":
|
||||
MESSAGE = "LF Workflows are enabled for everyone. Using LF runners."
|
||||
return WORKFLOW_LABEL_LF, MESSAGE
|
||||
elif username in user_list:
|
||||
elif formatted_username in user_list:
|
||||
MESSAGE = f"LF Workflows are enabled for {username}. Using LF runners."
|
||||
return WORKFLOW_LABEL_LF, MESSAGE
|
||||
else:
|
||||
|
|
|
|||
6
.github/workflows/_runner-determinator.yml
vendored
6
.github/workflows/_runner-determinator.yml
vendored
|
|
@ -99,6 +99,10 @@ jobs:
|
|||
|
||||
|
||||
def get_workflow_type(issue: Issue, username: str) -> Tuple[str, str]:
|
||||
formatted_username = (
|
||||
f"@{username}" # Add the @ symbol to match the format in the issue body
|
||||
)
|
||||
|
||||
try:
|
||||
user_list = issue.get_comments()[0].body.split()
|
||||
|
||||
|
|
@ -108,7 +112,7 @@ jobs:
|
|||
elif user_list[0] == "*":
|
||||
MESSAGE = "LF Workflows are enabled for everyone. Using LF runners."
|
||||
return WORKFLOW_LABEL_LF, MESSAGE
|
||||
elif username in user_list:
|
||||
elif formatted_username in user_list:
|
||||
MESSAGE = f"LF Workflows are enabled for {username}. Using LF runners."
|
||||
return WORKFLOW_LABEL_LF, MESSAGE
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue