Review Bot #200
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: Review Bot | |
on: | |
workflow_run: | |
workflows: | |
- Review-Trigger | |
types: | |
- completed | |
workflow_dispatch: | |
inputs: | |
pr-number: | |
description: "Number of the PR to evaluate" | |
required: true | |
type: number | |
jobs: | |
review-approvals: | |
runs-on: ubuntu-latest | |
environment: master | |
steps: | |
- name: Log | |
if: ${{ runner.debug }} | |
run: echo "::debug::$payload" | |
env: | |
payload: ${{ toJson(github.event) }} | |
- name: Extract content of artifact | |
if: ${{ !inputs.pr-number }} | |
id: number | |
uses: Bullrich/[email protected] | |
with: | |
artifact-name: pr_number | |
- name: Generate token | |
id: app_token | |
uses: actions/[email protected] | |
with: | |
app-id: ${{ secrets.REVIEW_APP_ID }} | |
private-key: ${{ secrets.REVIEW_APP_KEY }} | |
- name: Get PR ID | |
id: pr-id | |
run: | | |
PR_ID=$(gh run view -R ${{ github.repository }} ${{ github.event.workflow_run.id }} | grep -oP '#[0-9]+ . ${{ github.event.workflow_run.id }}' | grep -oP '#[0-9]+' | cut -c 2-) | |
echo "PR was $PR_ID" | |
echo "pr-id=${PR_ID}" >> $GITHUB_OUTPUT | |
- name: "Evaluates PR reviews and assigns reviewers" | |
uses: paritytech/[email protected] | |
with: | |
repo-token: ${{ steps.app_token.outputs.token }} | |
team-token: ${{ steps.app_token.outputs.token }} | |
checks-token: ${{ steps.app_token.outputs.token }} | |
# This is extracted from the triggering event | |
pr-number: ${{ inputs.pr-number || steps.number.outputs.content }} | |
request-reviewers: true |