-
Notifications
You must be signed in to change notification settings - Fork 459
46 lines (36 loc) · 1.27 KB
/
autolabel.yaml
File metadata and controls
46 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Update issue labels
on:
issue_comment:
types: [created]
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
cancel-in-progress: true
# Define labels here
env:
AWAITING_RESPONSE: stat:awaiting response
jobs:
auto_label:
name: Calculate and update issue labels
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Calculate labels
run: |
ADD_LABELS=()
REMOVE_LABELS=()
if [[ "${{ github.event.comment.author_association }}" == "MEMBER" ]]; then
ADD_LABELS+="${{ env.AWAITING_RESPONSE}}"
else
REMOVE_LABELS+="${{ env.AWAITING_RESPONSE}}"
fi
# Add further label logic here - uses bash
echo "ADD_LABELS=$(IFS=,; echo "${ADD_LABELS[*]}")" >> $GITHUB_ENV
echo "REMOVE_LABELS=$(IFS=,; echo "${REMOVE_LABELS[*]}")" >> $GITHUB_ENV
- name: Update labels
run: gh issue edit "$NUMBER" --add-label "$ADD_LABELS" --remove-label "$REMOVE_LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}