Difference between revisions of "Github Actions Repo Security Options"
Jump to navigation
Jump to search
(Created page with "``` name: Restrict Pull Requests on: pull_request: types: [opened, synchronize] jobs: restrict-pr: runs-on: ubuntu-latest steps: - name: Check PR Autho...") |
|||
| Line 1: | Line 1: | ||
| + | https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions | ||
| + | |||
``` | ``` | ||
name: Restrict Pull Requests | name: Restrict Pull Requests | ||
Latest revision as of 20:03, 1 October 2024
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