[llvm] [GitHub] Try a workaround to get the new contributor greeting to work (PR #75036)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 01:45:38 PST 2023


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/75036

For reasons unknown, the FIRST_TIMER and FIRST_TIME_CONTRIBUTOR states don't come through on new user PRs, I have opened https://github.com/orgs/community/discussions/78038 to see if that's my mistake or GitHub's.

In the meantime, a possible workaround is to check that we have none of the other states. If there's some bug that means the first time associations aren't available in workflows, maybe the association will be "NONE".

Also added a debug step to print that association so I can add it to the linked report. I will remove this as soon as I have 1 example PR.

>From 263e7c27b260ab93b540376ab0e993566a03eb34 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Mon, 11 Dec 2023 09:41:30 +0000
Subject: [PATCH] [GitHub] Try a workaround to get the new contributor greeting
 to work

For reasons unknown, the FIRST_TIMER and FIRST_TIME_CONTRIBUTOR states
don't come through on new user PRs, I have opened https://github.com/orgs/community/discussions/78038
to see if that's my mistake or GitHub's.

In the meantime, a possible workaround is to check that we have
none of the other states. If there's some bug that means the first
time associations aren't available in workflows, maybe the association
will be "NONE".

Also added a debug step to print that association so I can add it
to the linked report. I will remove this as soon as I have 1 example PR.
---
 .github/workflows/new-prs.yml | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/new-prs.yml b/.github/workflows/new-prs.yml
index 18caa408df57b6..23455c57ea7757 100644
--- a/.github/workflows/new-prs.yml
+++ b/.github/workflows/new-prs.yml
@@ -20,12 +20,19 @@ jobs:
     permissions:
       pull-requests: write
     # Only comment on PRs that have been opened for the first time, by someone
-    # new to LLVM or to GitHub as a whole.
+    # new to LLVM or to GitHub as a whole. Ideally we'd look for FIRST_TIMER
+    # or FIRST_TIME_CONTRIBUTOR, but this does not appear to work. Instead check
+    # that we do not have any of the other author associations.
+    # See https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request
+    # for all the possible values.
     if: >-
       (github.repository == 'llvm/llvm-project') &&
       (github.event.action == 'opened') &&
-      (github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
-       github.event.pull_request.author_association == 'FIRST_TIMER')
+      (github.event.pull_request.author_association != 'COLLABORATOR') &&
+      (github.event.pull_request.author_association != 'CONTRIBUTOR') &&
+      (github.event.pull_request.author_association != 'MANNEQUIN') &&
+      (github.event.pull_request.author_association != 'MEMBER') &&
+      (github.event.pull_request.author_association != 'OWNER')
     steps:
       - name: Setup Automation Script
         run: |
@@ -34,6 +41,14 @@ jobs:
           chmod a+x github-automation.py
           pip install -r requirements.txt
 
+      # Will be removed shortly, just gathering info to report to Github that
+      # this is not working as expected.
+      - name: Dump Author Association
+        env:
+          AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association }}
+        run: |
+          echo "$AUTHOR_ASSOCIATION"
+
       - name: Greet Author
         run: |
           ./github-automation.py \



More information about the llvm-commits mailing list