-
Notifications
You must be signed in to change notification settings - Fork 0
24 lines (22 loc) · 894 Bytes
/
Copy pathassign-auto.yml
File metadata and controls
24 lines (22 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
name: assign auto
on:
pull_request:
types: opened # プルリクを作成したタイミングだけで動かす
jobs:
assign:
name: Set assignees
runs-on: ubuntu-latest
steps:
- name: Set assignees
env:
ASSIGNEES: "${{ github.actor }}" # アサインするユーザー
run: |
assignee_count=$(cat ${{ github.event_path }} | jq '.pull_request.assignees | length')
if [[ 0 == $assignee_count ]]; then
assignees=$(echo "\"${ASSIGNEES// /}\"" | jq 'split(",")')
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{ \"assignees\": $assignees }" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/assignees
fi