Skip to content

Commit

Permalink
add review-bot to require fellows as reviewers
Browse files Browse the repository at this point in the history
Created a Github Action that uses the [Review-Bot app](https://github.com/paritytech/review-bot) to require fellows to review pull requests before allowing the PR to be merged.

The user's information is fetched always from the chain after every event.

It looks in the fellows data for a field named GitHub and it extracts the handle from there. This resolves polkadot-fellows#7 (you can find more information about the request there)

This uses [`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) for the event, not `pull_request`. This is a security measure so that an attacker doesn’t have access to the secrets.
  • Loading branch information
Bullrich committed Sep 18, 2023
1 parent bf6da3c commit 8bd3b49
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/review-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
rules:
- name: CI Files
condition:
include:
- ^\.github/.*
type: basic
minFellowsRank: 2
- name: Relay files
condition:
include:
- ^relay\/kusama\/.*
- ^relay\/polkadot\/.*
exclude:
- ^relay\/.+\.adoc$
type: basic
minFellowsRank: 4
- name: System Parachain Files
condition:
include:
- ^system-parachains\/.*
type: basic
minFellowsRank: 2
- name: Target Files
condition:
include:
- ^target\/.*
exclude:
- 'README.md'
type: basic
minFellowsRank: 4
- name: General Files
condition:
include:
- '.*'
exclude:
- ^relay\/kusama\/.*
- ^relay\/polkadot\/.*
- ^\.github/.*
- ^system-parachains\/.*
- ^target\/.*
type: basic
minFellowsRank: 1
32 changes: 32 additions & 0 deletions .github/workflows/review-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Review PR
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- review_requested
- review_request_removed
- ready_for_review
pull_request_review:

permissions:
contents: read
checks: write

jobs:
review-approvals:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: team_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.REVIEW_APP_ID }}
private_key: ${{ secrets.REVIEW_APP_KEY }}
- name: "Evaluates PR reviews and assigns reviewers"
uses: paritytech/review-bot@v1.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
team-token: ${{ steps.team_token.outputs.token }}
checks-token: ${{ steps.team_token.outputs.token }}

0 comments on commit 8bd3b49

Please sign in to comment.