Flutter バージョン更新手順をドキュメント化 #218
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Assign | |
on: | |
pull_request: | |
types: [ opened, ready_for_review ] | |
permissions: | |
pull-requests: write | |
jobs: | |
count-reviewers: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
outputs: | |
count: ${{ steps.extract.outputs.count }} | |
steps: | |
- name: Extract the number of reviewers | |
id: extract | |
run: | | |
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request | |
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=ready_for_review#pull_request | |
reviewers_count=$(cat ${{ github.event_path }} | jq '.pull_request.requested_reviewers | length') | |
echo "count=$reviewers_count" >> "$GITHUB_OUTPUT" | |
request-reviewers: | |
needs: | |
- count-reviewers | |
if: needs.count-reviewers.outputs.count == '0' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
# https://github.com/marketplace/actions/create-github-app-token | |
- name: Generate a token | |
id: app-token | |
uses: actions/create-github-app-token@e8e39f73bb84fdf315a015fa3104f314c0a258b4 # v1.8.1 | |
with: | |
app-id: ${{ secrets.APP_ID_OF_YUMEMI_TEAM_REVIEW_REQUESTER }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY_OF_YUMEMI_TEAM_REVIEW_REQUESTER }} | |
- name: Request reviewers | |
env: | |
REVIEWERS: ${{ vars.REVIEWERS }} | |
TEAM_REVIEWERS: ${{ vars.TEAM_REVIEWERS }} | |
run: | | |
reviewers=$(echo "\"${REVIEWERS// /}\"" | jq 'split(",")') | |
team_reviewers=$(echo "\"${TEAM_REVIEWERS// /}\"" | jq 'split(",")') | |
# https://docs.github.com/ja/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ | |
-d "{ \"reviewers\": $reviewers, \"team_reviewers\": $team_reviewers }" | |
request-assignees: | |
needs: | |
- count-reviewers | |
- request-reviewers | |
if: always() | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
# https://github.com/marketplace/actions/review-assign-action | |
- name: Request assignees | |
uses: hkusu/review-assign-action@5bee595fdb9765d4a0bd35724b6302fa15569158 # v1.4.0 | |
with: | |
assignees: ${{ github.actor }} | |
ready-comment: 'Ready for review :rocket:' |