Skip to content

Commit d3cc1de

Browse files
committed
Initial commit
1 parent d354770 commit d3cc1de

9 files changed

+294
-0
lines changed

.github/labels.json

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"type": {
3+
"kind": [
4+
{
5+
"name": "bug",
6+
"color": "D73A4A",
7+
"description": "Categorizes issue or PR as related to a bug."
8+
},
9+
{
10+
"name": "feature",
11+
"color": "A2EEEF",
12+
"description": "Categorizes issue or PR as related to a new feature."
13+
},
14+
{
15+
"name": "documentation",
16+
"color": "A2EEEF",
17+
"description": "Categorizes issue or PR as related to documentation."
18+
}
19+
],
20+
"priority": [
21+
{
22+
"name": "awaiting-more-evidence",
23+
"color": "FEF2C0",
24+
"description": "Lowest priority. Possibly useful, but not yet enough support to actually get it done."
25+
},
26+
{
27+
"name": "backlog",
28+
"color": "FBCA04",
29+
"description": "Higher priority than priority/awaiting-more-evidence."
30+
},
31+
{
32+
"name": "critical-urgent",
33+
"color": "B60205",
34+
"description": "Highest priority. Must be actively worked on as someone's top priority right now."
35+
},
36+
{
37+
"name": "important-longterm",
38+
"color": "E99695",
39+
"description": "Important over the long term, but may not be staffed and/or may need multiple releases to complete."
40+
},
41+
{
42+
"name": "important-soon",
43+
"color": "E99695",
44+
"description": "Must be staffed and worked on either currently, or very soon, ideally in time for the next release."
45+
}
46+
],
47+
"lifecycle": [
48+
{
49+
"name": "active",
50+
"color": "C2E0C6",
51+
"description": "Indicates that an issue or PR is actively being worked on by a contributor."
52+
},
53+
{
54+
"name": "frozen",
55+
"color": "BFD4F2",
56+
"description": "Indicates that an issue or PR should not be auto-closed due to staleness."
57+
},
58+
{
59+
"name": "rotten",
60+
"color": "87401D",
61+
"description": "Denotes an issue or PR that has aged beyond stale and will be auto-closed."
62+
},
63+
{
64+
"name": "stale",
65+
"color": "87401D",
66+
"description": "Denotes an issue or PR has remained open with no activity and has become stale."
67+
}
68+
],
69+
"sig": [
70+
],
71+
"area": [
72+
],
73+
"wg": [
74+
],
75+
"": [
76+
{
77+
"name": "lgtm",
78+
"color": "0E8A16",
79+
"description": "Indicates that a PR is ready to be merged."
80+
},
81+
{
82+
"name": "approved",
83+
"color": "0E8A16",
84+
"description": "Indicates a PR has been approved by an approver."
85+
},
86+
{
87+
"name": "ok-to-test",
88+
"color": "0E8A16",
89+
"description": "Indicates a non-member PR verified by an org member that is safe to test."
90+
}
91+
]
92+
}
93+
}

.github/workflows/command-assign.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: assign command
2+
on:
3+
repository_dispatch:
4+
types: [assign-command]
5+
jobs:
6+
assign:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Assign
10+
run: |
11+
if [ -n "${ARGS}" ];then
12+
i=0
13+
for person in ${ARGS};do
14+
if [ $i -ne 0 ];then
15+
people="${people}, "
16+
fi
17+
people="${people}\"${person}\""
18+
i=`expr $i + 1`
19+
done
20+
else
21+
people="\"${{ github.actor }}\""
22+
fi
23+
24+
if [ -n "${PR_NUM}" ];then
25+
echo "{\"reviewers\":[${people}]}" | gh api repos/${REPO}/pulls/${PR_NUM}/requested_reviewers -X POST --input -
26+
else
27+
echo "{\"assignees\":[${people}]}" | gh api repos/${REPO}/issues/${ISSUE_NUM}/assignees -X POST --input -
28+
fi
29+
env:
30+
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
31+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
32+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
33+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
34+
GITHUB_TOKEN: ${{secrets.PAT}}

.github/workflows/command-close.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: close command
2+
on:
3+
repository_dispatch:
4+
types: [close-command]
5+
jobs:
6+
close:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Close Issue
10+
run: |
11+
if [ -n "${PR_NUM}" ];then
12+
gh pr close ${PR_NUM} -R ${REPO}
13+
else
14+
gh issue close ${ISSUE_NUM} -R ${REPO}
15+
fi
16+
env:
17+
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
18+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
19+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
20+
GITHUB_TOKEN: ${{secrets.PAT}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: ensure-labels command
2+
on:
3+
repository_dispatch:
4+
types: [ensure-labels-command]
5+
jobs:
6+
assign:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Ensure labels
11+
run: |
12+
file=".github/labels.json"
13+
repo=${{ github.event.client_payload.github.payload.repository.full_name }}
14+
for t in $(jq -r ".type | keys | .[]" ${file});do
15+
v=$(jq -r ".type[\"${t}\"][]" ${file})
16+
for name in $(jq -r ".name" <<< ${v} );do
17+
color=$(jq -r ". | select(.name == \"${name}\") | .color" <<< ${v} )
18+
desc=$(jq -r ". | select(.name == \"${name}\") | .description" <<< ${v} )
19+
# Create data to send
20+
data="{"
21+
if [ -n "${t}" ];then
22+
data="${data}\"name\":\"${t}/${name}\""
23+
else
24+
data="${data}\"name\":\"${name}\""
25+
fi
26+
if [ -n "${color}" ];then
27+
data="${data}, \"color\":\"${color}\""
28+
fi
29+
if [ -n "${desc}" ];then
30+
data="${data}, \"description\":\"${desc}\""
31+
fi
32+
data="${data}}"
33+
# Send data
34+
curl \
35+
-X POST \
36+
-H "Accept: application/vnd.github.v3+json" \
37+
-H "Authorization: token ${{ secrets.PAT }}" \
38+
https://api.github.com/repos/${repo}/labels \
39+
-d "${data}"
40+
done
41+
done

.github/workflows/command-harray.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: hooray command
2+
on:
3+
repository_dispatch:
4+
types: [hooray-command]
5+
jobs:
6+
hooray:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Add reaction
10+
uses: peter-evans/create-or-update-comment@v1
11+
with:
12+
token: ${{ secrets.PAT }}
13+
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
14+
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
15+
reaction-type: hooray

.github/workflows/command-kind.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: kind command
2+
on:
3+
repository_dispatch:
4+
types: [kind-command]
5+
jobs:
6+
kind:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Add kind label to issue
10+
run: |
11+
# args should not be empty
12+
if [ -z "${ARGS}" ];then
13+
false
14+
fi
15+
16+
# args should only contain one value
17+
if [[ "${ARGS}" = *" "* ]];then
18+
false
19+
fi
20+
21+
label="kind/${ARGS}"
22+
if [ -n "${PR_NUM}" ];then
23+
echo "{\"labels\":[\"${label}\"]}" | gh api repos/${REPO}/pulls/${PR_NUM}/labels -X POST --input -
24+
else
25+
echo "{\"labels\":[\"${label}\"]}" | gh api repos/${REPO}/issues/${ISSUE_NUM}/labels -X POST --input -
26+
fi
27+
env:
28+
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
29+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
30+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
31+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
32+
GITHUB_TOKEN: ${{secrets.PAT}}

.github/workflows/command-reopen.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: reopen command
2+
on:
3+
repository_dispatch:
4+
types: [reopen-command]
5+
jobs:
6+
reopen:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Reopen Issue
10+
run: |
11+
if [ -n "${PR_NUM}" ];then
12+
gh pr reopen ${PR_NUM} -R ${REPO}
13+
else
14+
gh issue reopen ${ISSUE_NUM} -R ${REPO}
15+
fi
16+
env:
17+
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
18+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
19+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
20+
GITHUB_TOKEN: ${{secrets.PAT}}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: unassign command
2+
on:
3+
repository_dispatch:
4+
types: [unassign-command]
5+
jobs:
6+
unassign:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Unassign
10+
run: |
11+
if [ -n "${ARGS}" ];then
12+
i=0
13+
for person in ${ARGS};do
14+
if [ $i -ne 0 ];then
15+
people="${people}, "
16+
fi
17+
people="${people}\"${person}\""
18+
i=`expr $i + 1`
19+
done
20+
else
21+
people="\"${{ github.actor }}\""
22+
fi
23+
if [ -n "${PR_NUM}" ];then
24+
echo "{\"reviewers\":[${people}]}" | gh api repos/${REPO}/pulls/${PR_NUM}/requested_reviewers -X DELETE --input -
25+
else
26+
echo "{\"assignees\":[${people}]}" | gh api repos/${REPO}/issues/${ISSUE_NUM}/assignees -X DELETE --input -
27+
fi
28+
env:
29+
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
30+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
31+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
32+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
33+
GITHUB_TOKEN: ${{secrets.PAT}}

.github/workflows/slash-command-dispatch.yml

+6
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ jobs:
1212
token: ${{ secrets.PAT }}
1313
commands: |
1414
hooray
15+
ensure-labels
16+
close
17+
reopen
18+
assign
19+
unassign
20+
kind

0 commit comments

Comments
 (0)