Skip to content

Commit 4843bd6

Browse files
committed
Fix labeler workflow
1 parent 6e7e345 commit 4843bd6

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/labeler.yaml

+16-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ on:
2222
issues:
2323
types: [opened]
2424
env:
25-
# If this workflow is triggered by an `opened` event, the user type is always 'user'.
26-
user_type: ${{ contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), github.event.comment.author_association) && 'maintainer' || 'user' }}
25+
issue_user_type: >-
26+
${{
27+
contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), github.event.issue.author_association) && 'maintainer' || 'user'
28+
}}
29+
comment_user_type: >-
30+
${{
31+
github.event_type == 'issue_comment' &&
32+
(
33+
contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), github.event.comment.author_association) && 'maintainer' || 'user'
34+
) || null
35+
}}
2736
2837
permissions:
2938
issues: write
@@ -38,9 +47,13 @@ jobs:
3847

3948
# The `waiting-for-maintainer` label needs to match with the one in `close-stale.yaml`!
4049
- name: Add `waiting-for-maintainer` label
41-
if: env.user_type == 'user'
50+
if: github.event_type == 'issues' && env.issue_user_type == 'user' || env.comment_user_type == 'user'
4251
env:
4352
ISSUE: ${{ github.event.issue.html_url }}
4453
GH_TOKEN: ${{ github.token }}
54+
ISSUE_USER_TYPE: ${{ env.issue_user_type }}
55+
COMMENT_USER_TYPE: ${{ env.comment_user_type }}
4556
run: |
57+
echo "Issue created by: " $ISSUE_USER_TYPE
58+
echo "Comment created by:" $COMMENT_USER_TYPE
4659
gh issue edit $ISSUE --add-label 'waiting-for-maintainer' --remove-label 'waiting-for-user'

0 commit comments

Comments
 (0)