Allow PR authors to use /rerun-failed-ci on their own PRs (#19496)
Co-authored-by: Alison Shao <alisonshao@MacBook-Pro-D2W773R9CD.local>
This commit is contained in:
co-authored by
Alison Shao
parent
fe4bc8ebd5
commit
2c856c6d27
@@ -73,6 +73,8 @@ Then your PR can be merged.
|
|||||||
We have a lot of open PRs but limited CI machines, so only top and trusted contributors have permission to trigger CI tests.
|
We have a lot of open PRs but limited CI machines, so only top and trusted contributors have permission to trigger CI tests.
|
||||||
Users with permission are listed in the [CI_PERMISSIONS.json](https://github.com/sgl-project/sglang/blob/main/.github/CI_PERMISSIONS.json)
|
Users with permission are listed in the [CI_PERMISSIONS.json](https://github.com/sgl-project/sglang/blob/main/.github/CI_PERMISSIONS.json)
|
||||||
|
|
||||||
|
**PR authors** can always use `/rerun-failed-ci` on their own PRs, even if they are not listed in `CI_PERMISSIONS.json`.
|
||||||
|
|
||||||
For CI to run on a pull request, it must have the "run-ci" label. Authorized users can add the label or rerun failed tests by commenting on the PR with one of these commands:
|
For CI to run on a pull request, it must have the "run-ci" label. Authorized users can add the label or rerun failed tests by commenting on the PR with one of these commands:
|
||||||
|
|
||||||
- `/tag-run-ci-label`: Adds the "run-ci" label. Every future commit will trigger CI.
|
- `/tag-run-ci-label`: Adds the "run-ci" label. Every future commit will trigger CI.
|
||||||
@@ -86,7 +88,7 @@ To avoid spamming a PR with too many `/rerun-failed-ci` comments, you can also t
|
|||||||
|
|
||||||
Example of rerunning a single test stage: `/rerun-stage unit-test-backend-4-gpu`.
|
Example of rerunning a single test stage: `/rerun-stage unit-test-backend-4-gpu`.
|
||||||
|
|
||||||
If you don’t have permission, please ask maintainers to trigger CI for you.
|
If you don’t have permission and you’re not the PR author, please ask maintainers to trigger CI for you.
|
||||||
|
|
||||||
### CI rate limits
|
### CI rate limits
|
||||||
|
|
||||||
|
|||||||
@@ -415,13 +415,9 @@ def main():
|
|||||||
comment_body = get_env_var("COMMENT_BODY").strip()
|
comment_body = get_env_var("COMMENT_BODY").strip()
|
||||||
user_login = get_env_var("USER_LOGIN")
|
user_login = get_env_var("USER_LOGIN")
|
||||||
|
|
||||||
# 2. Load Permissions (Local Check)
|
# 2. Load Permissions (local file check first to avoid unnecessary API calls)
|
||||||
user_perms = load_permissions(user_login)
|
user_perms = load_permissions(user_login)
|
||||||
|
|
||||||
if not user_perms:
|
|
||||||
print(f"User {user_login} does not have any configured permissions. Exiting.")
|
|
||||||
return
|
|
||||||
|
|
||||||
# 3. Initialize GitHub API with Auth
|
# 3. Initialize GitHub API with Auth
|
||||||
auth = Auth.Token(token)
|
auth = Auth.Token(token)
|
||||||
g = Github(auth=auth)
|
g = Github(auth=auth)
|
||||||
@@ -430,6 +426,26 @@ def main():
|
|||||||
pr = repo.get_pull(pr_number)
|
pr = repo.get_pull(pr_number)
|
||||||
comment = repo.get_issue(pr_number).get_comment(comment_id)
|
comment = repo.get_issue(pr_number).get_comment(comment_id)
|
||||||
|
|
||||||
|
# PR authors can always rerun failed CI on their own PRs,
|
||||||
|
# even if they are not listed in CI_PERMISSIONS.json.
|
||||||
|
# Note: /tag-run-ci-label and /rerun-stage still require CI_PERMISSIONS.json.
|
||||||
|
if pr.user.login == user_login:
|
||||||
|
if user_perms is None:
|
||||||
|
print(
|
||||||
|
f"User {user_login} is the PR author (not in CI_PERMISSIONS.json). "
|
||||||
|
"Granting CI rerun permissions."
|
||||||
|
)
|
||||||
|
user_perms = {}
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
f"User {user_login} is the PR author and has existing CI permissions."
|
||||||
|
)
|
||||||
|
user_perms["can_rerun_failed_ci"] = True
|
||||||
|
|
||||||
|
if not user_perms:
|
||||||
|
print(f"User {user_login} does not have any configured permissions. Exiting.")
|
||||||
|
return
|
||||||
|
|
||||||
# 4. Parse Command and Execute
|
# 4. Parse Command and Execute
|
||||||
first_line = comment_body.split("\n")[0].strip()
|
first_line = comment_body.split("\n")[0].strip()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user