Skip to content

Commit 07b603d

Browse files
committed
temp
1 parent 0cd6449 commit 07b603d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/workflows/autolabel.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Update issue labels
22

3+
# Trigger for the workflow
4+
# This trigger will populate the github.event object
5+
# Details on properties are here: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=created#issue_comment
36
on:
47
issue_comment:
58
types: [created]
@@ -23,23 +26,18 @@ jobs:
2326
steps:
2427
- name: Calculate labels
2528
run: |
26-
ADD_LABELS=()
27-
REMOVE_LABELS=()
2829
2930
if [[ "${{ github.event.comment.author_association }}" == "MEMBER" ]]; then
30-
ADD_LABELS+="${{ env.AWAITING_RESPONSE}}"
31+
echo ADD="${{ env.AWAITING_RESPONSE}}" >> $GITHUB_ENV
3132
else
32-
REMOVE_LABELS+="${{ env.AWAITING_RESPONSE}}"
33+
echo REMOVE="${{ env.AWAITING_RESPONSE}}" >> $GITHUB_ENV
3334
fi
3435
35-
36-
# Add further label logic here - uses bash
37-
38-
echo "ADD_LABELS=$(IFS=,; echo "${ADD_LABELS[*]}")" >> $GITHUB_ENV
39-
echo "REMOVE_LABELS=$(IFS=,; echo "${REMOVE_LABELS[*]}")" >> $GITHUB_ENV
40-
4136
- name: Update labels
42-
run: gh issue edit "$NUMBER" --add-label "$ADD_LABELS" --remove-label "$REMOVE_LABELS"
37+
# This runs a command using the github cli: https://cli.github.com/manual/gh_issue_edit
38+
# If $ADD is set, it will add the label, otherwise it will remove the label
39+
# There is no need to check if $ADD or $REMOVE is set, as the command will ignore it if it is empty
40+
run: gh issue edit "$NUMBER" --add-label "$ADD" --remove-label "$REMOVE"
4341
env:
4442
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4543
GH_REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)