Skip to content

Commit

Permalink
Create auto-assign.yml (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato authored Jul 28, 2020
1 parent ea96fbe commit 6a0e007
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Assign auto

on:
pull_request:
types: opened

jobs:
assign:
name: Set assignees
runs-on: ubuntu-18.04
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

0 comments on commit 6a0e007

Please sign in to comment.