This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 4843bd699c Fix `labeler` workflow
4843bd699c is described below

commit 4843bd699ce4890a73d0458130ab321df64ae414
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Sat Apr 27 19:59:04 2024 +0200

    Fix `labeler` workflow
---
 .github/workflows/labeler.yaml | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml
index dac25d983b..38c61b6a67 100644
--- a/.github/workflows/labeler.yaml
+++ b/.github/workflows/labeler.yaml
@@ -22,8 +22,17 @@ on:
   issues:
     types: [opened]
 env:
-  # If this workflow is triggered by an `opened` event, the user type is 
always 'user'.
-  user_type: ${{ contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), 
github.event.comment.author_association) && 'maintainer' || 'user' }}
+  issue_user_type: >-
+    ${{
+      contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), 
github.event.issue.author_association) && 'maintainer' || 'user'
+    }}
+  comment_user_type: >-
+    ${{
+      github.event_type == 'issue_comment' &&
+      (
+        contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), 
github.event.comment.author_association) && 'maintainer' || 'user'
+      ) || null
+    }}
 
 permissions:
   issues: write
@@ -38,9 +47,13 @@ jobs:
 
      # The `waiting-for-maintainer` label needs to match with the one in 
`close-stale.yaml`!
      - name: Add `waiting-for-maintainer` label
-       if: env.user_type == 'user'
+       if: github.event_type == 'issues' && env.issue_user_type == 'user' || 
env.comment_user_type == 'user'
        env:
          ISSUE: ${{ github.event.issue.html_url }}
          GH_TOKEN: ${{ github.token }}
+         ISSUE_USER_TYPE: ${{ env.issue_user_type }}
+         COMMENT_USER_TYPE: ${{ env.comment_user_type }}
        run: |
+         echo "Issue created by: " $ISSUE_USER_TYPE
+         echo "Comment created by:" $COMMENT_USER_TYPE
          gh issue edit $ISSUE --add-label 'waiting-for-maintainer' 
--remove-label 'waiting-for-user'

Reply via email to