File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Auto assign the issue via `take` comment
2
+
3
+ on :
4
+ issue_comment :
5
+ types : [created]
6
+
7
+ permissions :
8
+ issues : write
9
+
10
+ jobs :
11
+ auto-assign :
12
+ runs-on : ubuntu-latest
13
+ if : (!github.event.issue.pull_request) && github.event.comment.body == 'take'
14
+ concurrency :
15
+ # Only run one at a time for each user.
16
+ group : ${{ github.actor }}-issue-assign
17
+ steps :
18
+ - run : |
19
+ CODE=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -LI https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees/${{ github.event.comment.user.login }} -o /dev/null -w '%{http_code}\n' -s)
20
+ if [ "$CODE" -eq "204" ]
21
+ then
22
+ echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
23
+ curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
24
+ else
25
+ echo "Cannot assign issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
26
+ fi
You can’t perform that action at this time.
0 commit comments