diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c4a6046e5dca..55b148b0c10e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,6 +26,7 @@ Fixes # (issue) [documentation guidelines](https://github.com/huggingface/diffusers/tree/main/docs), and [here are tips on formatting docstrings](https://github.com/huggingface/diffusers/tree/main/docs#writing-source-documentation). - [ ] Did you write any new necessary tests? +- [ ] Are you the author (or part of the team) of the model/pipeline (only applicable for model/pipeline related PRs)? ## Who can review? diff --git a/utils/remind_link_issue.py b/utils/remind_link_issue.py index d4e6aa9d50c1..bde7e5430440 100644 --- a/utils/remind_link_issue.py +++ b/utils/remind_link_issue.py @@ -25,6 +25,7 @@ import logging import os +import re from datetime import datetime, timedelta, timezone import requests @@ -37,6 +38,11 @@ REMINDER_MARKER = "" BYPASS_LABELS = {"no-issue-needed"} LOOKBACK_DAYS = 2 +# A PR authored by the model/pipeline's own team does not need to link an issue. +# Matches a checked task-list item for the corresponding PR template checkbox. +AUTHOR_CHECKBOX_PATTERN = re.compile( + r"-\s*\[\s*[xX]\s*\]\s*Are you the author \(or part of the team\) of the model/pipeline" +) CONTRIBUTION_GUIDE_URL = "https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents" GRAPHQL_URL = "https://api.github.com/graphql" @@ -68,6 +74,10 @@ def has_linked_issue(token, owner, name, number): return data["repository"]["pullRequest"]["closingIssuesReferences"]["totalCount"] > 0 +def author_checkbox_checked(pr): + return bool(AUTHOR_CHECKBOX_PATTERN.search(pr.body or "")) + + def has_existing_reminder(pr): return any(REMINDER_MARKER in (c.body or "") for c in pr.get_issue_comments()) @@ -112,6 +122,8 @@ def main(): labels = {label.name for label in pr.labels} if labels & BYPASS_LABELS: continue + if author_checkbox_checked(pr): + continue if has_linked_issue(token, owner, name, pr.number): continue if has_existing_reminder(pr):