Skip to content

Conversation

clee2000
Copy link
Contributor

@clee2000 clee2000 commented Oct 28, 2022

  • 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 #87865

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 28, 2022

🔗 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 Failures

As of commit dc46cb5:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Oct 28, 2022
@clee2000 clee2000 removed the topic: not user facing topic category label Oct 28, 2022
@clee2000 clee2000 added the topic: not user facing topic category label Oct 28, 2022
@clee2000 clee2000 changed the title labels Move check labels to separate workflow Oct 28, 2022
@clee2000 clee2000 marked this pull request as ready for review October 28, 2022 20:41
@clee2000 clee2000 requested a review from a team as a code owner October 28, 2022 20:41
Copy link
Contributor

@huydhn huydhn left a 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

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 28, 2022
@clee2000
Copy link
Contributor Author

clee2000 commented Oct 28, 2022

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.

Comment on lines 43 to 52
# 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):
Copy link
Contributor

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)

Copy link
Contributor Author

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

@ZainRizvi
Copy link
Contributor

I think now that we block on labels, that workflow can be removed.

+1 to removing that old one

@clee2000 clee2000 removed the topic: not user facing topic category label Oct 28, 2022
@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Oct 31, 2022
@clee2000
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Nov 5, 2022
* 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
kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
* 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
@github-actions github-actions bot deleted the csl/label branch April 29, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PR Label enforcer] When a label is added to a PR, trigger the worflow to re-verify the existence of the label

4 participants