-
Notifications
You must be signed in to change notification settings - Fork 15
36 lines (34 loc) · 1.4 KB
/
issue-auto-implement-setup.yml
File metadata and controls
36 lines (34 loc) · 1.4 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
# One-time setup: create the labels required by issue-auto-implement.
# Run manually (Actions → Issue auto-implement setup → Run workflow) once per repo.
# After this runs, the "automation/auto-implement" label will exist so you can add it to issues.
name: Issue auto-implement setup
on:
workflow_dispatch:
jobs:
create-labels:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create labels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
LABEL_PREFIX: automation
run: |
for LABEL in auto-implement needs-info pr-created; do
NAME="${LABEL_PREFIX}/${LABEL}"
CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$REPO/labels" \
-d "{\"name\":\"$NAME\",\"color\":\"ededed\",\"description\":\"Issue auto-implement: $LABEL\"}")
if [ "$CODE" = "201" ]; then
echo "Created label: $NAME"
elif [ "$CODE" = "422" ]; then
echo "Label already exists: $NAME"
else
echo "::warning::Unexpected response $CODE for $NAME"
fi
done
echo "Done. You can now add the label $LABEL_PREFIX/auto-implement to issues."