mumrah commented on code in PR #17881:
URL: https://github.com/apache/kafka/pull/17881#discussion_r1854582483


##########
.github/workflows/pr-update.yml:
##########
@@ -45,3 +47,40 @@ jobs:
         PR_NUM: ${{github.event.number}}
       run: |
         ./.github/scripts/label_small.sh
+
+  add-triage-label:
+    if: github.event.action == 'opened' || github.event.action == 'reopened'
+    name: Add triage label
+    runs-on: ubuntu-latest
+    permissions:
+      pull-requests: write
+    steps:
+      - name: Env
+        run: printenv
+        env:
+          GITHUB_CONTEXT: ${{ toJson(github) }}
+      - name: Check PR Author  # The step sets output "exitcode" to 0 iff the 
PR is from a committer.
+        id: check-author
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR_USER: ${{ github.event.pull_request.user.login }}
+        run: |
+          set +e
+          echo "Checking repo contributors for PR author $PR_USER"
+          FOUND_CONTRIBUTOR=$(gh api \
+            -H "Accept: application/vnd.github+json" \
+            -H "X-GitHub-Api-Version: 2022-11-28" \
+            /repos/apache/kafka/contributors --jq '.[] | select(.login == 
"'"$PR_USER"'") | .login')

Review Comment:
   You're right 😖 
   
   I think we can query the "orgs" API to check if the author is a member of 
`apache`, but that won't tell us if they are a committer. That would at least 
prevent committers from having the `triage` label added.
   
   ---
   
   Another approach is to create a list of committers by GH username. This is 
related to another improvement I've been contemplating. I'd like to separate 
the "reviewers" (anyone in community) from the "approvers" (must be committer) 
in our commit messages. A config file of GH usernames + email + preferred name 
is how I would approach that one. We could use this config file as the input 
for this task which would solve the problem.
   
   WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to