PR-24: Add workflow to check for reviewers & assignments #3
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 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 |