-
-
Notifications
You must be signed in to change notification settings - Fork 99
23 lines (23 loc) · 940 Bytes
/
assign_issue.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
name: Assign Issue
on:
issue_comment:
jobs:
assign:
runs-on: ubuntu-latest
name: Assign Issue
steps:
- run: |
BODY="$(jq '.comment.body' $GITHUB_EVENT_PATH)"
ISSUE_NUMBER="$(jq '.issue.number' $GITHUB_EVENT_PATH)"
LOGIN="$(jq '.comment.user.login' $GITHUB_EVENT_PATH | tr -d \")"
if [[ $BODY == *".assign"* ]]; then
echo "Assigning issue $ISSUE_NUMBER to $LOGIN"
echo "Using the link: https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/assignees"
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/assignees \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{"assignees":["'"$LOGIN"'"]}' \
--fail
fi
shell: bash