Skip to content

Commit

Permalink
pr_labeler: address potential race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gotmax23 committed Jan 7, 2024
1 parent 28526b8 commit a4f58c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hacking/pr_labeler/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,14 @@ def is_new_contributor_manual(ctx: IssueOrPrCtx) -> bool:
Determine whether a user has previously opened an issue or PR in this repo
without needing special API access.
"""
query_data = dict(repo=ctx.global_args.full_repo, author=ctx.issue.user.login)
query_data = {
"repo": "ansible/ansible-documentation",
"author": ctx.issue.user.login,
# Avoid potential race condition where a new contributor opens multiple
# PRs or issues at once.
# Better to welcome twice than not at all.
"is": "closed",
}
issues = ctx.client.search_issues("", **query_data)
for issue in issues:
if issue.number != ctx.issue.number:
Expand Down

0 comments on commit a4f58c0

Please sign in to comment.