-
-
Notifications
You must be signed in to change notification settings - Fork 664
62 lines (54 loc) 路 1.78 KB
/
Copy pathissue-labeler.yaml
File metadata and controls
62 lines (54 loc) 路 1.78 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Issue Labeler
on:
issues:
types:
- reopened
- opened
env:
OUTPUT_CLIENTS: >-
axios fetch hono angular angular-query react-query vue-query svelte-query
solid-query solid-start swr zod mcp
jobs:
label-issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add label from issue form
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
client="$(printf '%s\n' "$ISSUE_BODY" | awk 'BEGIN{IGNORECASE=1} /^### Output client[[:space:]]*$/{while (getline) {gsub(/\r/, ""); line=$0; gsub(/^[[:space:]]+|[[:space:]]+$/, "", line); if (line != "") {print tolower(line); exit}}}')"
if [ -z "$client" ]; then
echo "No output client label; skipping."
exit 0
fi
case " $OUTPUT_CLIENTS " in
*" $client "*)
label="$client"
# labels and output clients don't map 1:1, so map to existing repo labels
case "$client" in
react-query)
label="tanstack-query"
;;
angular-query)
label="angular"
;;
solid-query|solid-start)
label="solid"
;;
svelte-query)
label="svelte"
;;
esac
echo "Resolved issue label: '$label'"
gh issue edit "$NUMBER" --repo "$REPO" --add-label "$label"
;;
*)
echo "Unsupported client label '$client'; skipping."
exit 0
;;
esac