labeler: retrieve author_association from event data

The Github Actions API token apparently doesn't have sufficient ACLs to
retrieve this from the API.

Fixes: https://github.com/ansible/ansible-documentation/issues/204
This commit is contained in:
Maxwell G
2023-07-31 01:49:03 +00:00
parent 1f1252d356
commit feabfb631b

View File

@@ -160,8 +160,11 @@ def new_contributor_welcome(ctx: IssueOrPrCtx) -> None:
# This contributor has already been welcomed!
if "new_contributor" in ctx.previously_labeled:
return
log(ctx, "author_association is", ctx.member.raw_data["author_association"])
if ctx.member.raw_data["author_association"] not in {
author_association = ctx.event_member.get(
"author_association", ctx.member.raw_data["author_association"]
)
log(ctx, "author_association is", author_association)
if author_association not in {
"FIRST_TIMER",
"FIRST_TIME_CONTRIBUTOR",
}: