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: Prevent contributors from making PRs to the main branch | |
on: | |
pull_request_target: | |
branches: | |
- main | |
types: | |
- opened | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
close_pull_request: | |
runs-on: ubuntu-latest | |
if: ${{ github.head_ref != 'develop' || github.event.pull_request.author_association != 'OWNER' }} | |
steps: | |
- name: Print github | |
run: echo '${{ toJson(github) }}' | |
- name: Closing pull request with comment | |
run: | | |
echo "All PRs from contributors should be based on, and directed towards, the develop branch. Closing this PR..." | |
gh pr close ${{ github.event.pull_request.number }} -c "Auto-closing: all PRs from contributors should be based on, and directed towards, the develop branch." |