Add workflow to check for required reviews #1
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: Check required reviews | |
on: | |
pull_request: | |
types: [labeled] | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
check-reviews: | |
# Only run if passing the basic GitHub review requirements. | |
if: github.event.review.state == 'APPROVED' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Check reviews | |
env: | |
PR_REF: github.ref | |
shell: python | |
run: | | |
import os | |
import sys | |
ref = os.getenv("PR_REF") | |
print(f"Ref: {ref}") | |
# Get info with gh pr -R MetOffice/CSET view $PR_NUMBER --json | |
# labels,reviews If full_review label exists parse with program to see | |
# if enough reviews. Newer reviews by the same person should | |
# invalidate older reviews. | |
sys.exit(0) |