Github Actions Repo Security Options
Jump to navigation
Jump to search
name: Restrict Pull Requests
on:
pull_request:
types: [opened, synchronize]
jobs:
restrict-pr:
runs-on: ubuntu-latest
steps:
- name: Check PR Author
id: check-author
run: |
ALLOWED_USERS=("user1" "user2" "user3")
PR_AUTHOR=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH")
if [[ ! " ${ALLOWED_USERS[@]} " =~ " ${PR_AUTHOR} " ]]; then
echo "This user is not allowed to create pull requests."
exit 1
fi