-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Move check labels to separate workflow #87999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/87999
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit dc46cb5: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! One the other hand, I'm a bit confused between this new check-labels
workflow and the existing is-properly-labeled
one in https://github.com/pytorch/pytorch/blob/master/.github/workflows/pr-labels.yml. Now that we are enforcing the label check in the PR, running is-properly-labeled
does no harm, but a bit redundant I think
I think now that we block on labels, that workflow can be removed. |
# Check if PR is not user facing | ||
is_not_user_facing_pr = any(label.strip() == "topic: not user facing" for label in pr_labels) | ||
if is_not_user_facing_pr: | ||
return True | ||
|
||
# Check if bot has already posted a message within the past hour to include a release notes label | ||
# Delete all previous comments | ||
for comment in pr.get_comments(): | ||
if comment.body_text.lstrip(" #").startswith(ERR_MSG_TITLE) and comment.author_login in BOT_AUTHORS: | ||
ts = datetime.strptime(comment.created_at, "%Y-%m-%dT%H:%M:%SZ") | ||
if (datetime.utcnow() - ts) < timedelta(hours=1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This old check was there to rate limit ourselves if a person is pushing multiple commits to their PR but they haven't yet added a label it it.
Perhaps it's better to split this into two functions:
- has_required_labels(pr) - which only returns a bool and doesn't delete any comments
- delete_stale_comments(pr, has_required_labels: bool) - If the labels are there, then it deletes it's old comment. If the label still isn't there, then it'll only delete the comment if it was last posted more than an hour ago (the old behavior)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- split up into check for labels, add comment, and delete comment
- delete comments if has labels
- add comment if does not have label and does not have comment yet - not quite the same but i dont want to spam with extra comments when one already exists
+1 to removing that old one |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
* moves check labels to separate workflow that is triggered on the usual pull_request triggers as well as labeled and unlabeled * deletes comments when label is added Fixes pytorch/test-infra#978 and pytorch#87865 Pull Request resolved: pytorch#87999 Approved by: https://github.com/huydhn
* moves check labels to separate workflow that is triggered on the usual pull_request triggers as well as labeled and unlabeled * deletes comments when label is added Fixes pytorch/test-infra#978 and pytorch#87865 Pull Request resolved: pytorch#87999 Approved by: https://github.com/huydhn
Fixes pytorch/test-infra#978 and #87865