Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GitHub] Try a workaround to get the new contributor greeting to work #75036

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

DavidSpickett
Copy link
Collaborator

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.

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.
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 11, 2023

@llvm/pr-subscribers-github-workflow

Author: David Spickett (DavidSpickett)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/75036.diff

1 Files Affected:

  • (modified) .github/workflows/new-prs.yml (+18-3)
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 \

Copy link
Collaborator

@tstellar tstellar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me.

@DavidSpickett DavidSpickett merged commit 7cee470 into llvm:main Dec 12, 2023
5 checks passed
@DavidSpickett DavidSpickett deleted the new-contrib branch December 12, 2023 09:53
@DavidSpickett
Copy link
Collaborator Author

This did the trick, I think this was the first one: #75182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants