What is the correct way to check for author_association == FIRST_TIME_CONTRIBUTOR in a workflow? #78038
Replies: 4 comments 1 reply
-
I came across https://michaelheap.com/github-actions-check-permission/ but again it's only looking for a subset of the values. It is using the |
Beta Was this translation helpful? Give feedback.
-
The starter action does not take this approach and appears to list PRs until the author is found or it gets to the end of the PR list: https://github.com/actions/first-interaction/blob/main/src/main.ts#L127 Which seems like a strategy best avoided on a very large project like LLVM. |
Beta Was this translation helpful? Give feedback.
-
I ended up using a workaround where I check for every other status than I also printed what the association value was for first time contributor PRs was and it was (you can see the implementation in llvm/llvm-project@c8655fc)
So I am no closer to understanding why the first timer associations don't make it to the event that actions sees, but for LLVM's purposes, we now have a workaround that works. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
In https://github.com/llvm/llvm-project/blob/main/.github/workflows/new-prs.yml I have attempted to create a workflow that will as its first step, check if the user is new to the LLVM project and add a greeting comment.
This part of the job is guarded with:
Which I tested on my own fork by checking for 'OWNER' as one of the values and that works.
Fast forward to now and it's active in llvm but it's getting skipped even for a new contributor PR e.g. llvm/llvm-project#74584.
I have been through all the resources I could find on if syntax, and looked through Github code search for any other workflows checking this value. I only found references to the other associations.
The only thing I can think of is that the set of values within a workflow is not the same as the set you would get from REST:
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request states
Which implies that it can also be something else, which I guess would be nothing or empty string if you don't have permissions.
I thought maybe it is permissions but couldn't find anything that said you'd need extra permissions to read the details of the author of a pull request. Besides, the job already has write (which I think implies read) for pull requests.
Can anyone point out what I'm doing wrong here?
Beta Was this translation helpful? Give feedback.
All reactions