Skip to content

PR-24: Add workflow to check for reviewers & assignments #4

PR-24: Add workflow to check for reviewers & assignments

PR-24: Add workflow to check for reviewers & assignments #4

Workflow file for this run

name: Check PR Reviewers and Assignments
on:
pull_request:
types:
- opened
- synchronize
- edited
- reopened
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- name: Check for Reviewers
id: reviewers
run: |
reviewers=$(jq -r '.pull_request.requested_reviewers | length' "$GITHUB_EVENT_PATH")
echo "Reviewers: $reviewers"
if [[ $reviewers -eq 0 ]]; then
echo "Error: The PR has no reviewers."
echo "::set-output name=has_reviewers::false"
else
echo "::set-output name=has_reviewers::true"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for Assignees
run: |
assignees=$(jq -r '.pull_request.assignees | length' "$GITHUB_EVENT_PATH")
if [[ $assignees -eq 0 ]]; then
echo "Error: The PR has no assignees."
exit 1
fi