File tree Expand file tree Collapse file tree
actions/block-pr-not-on-main Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : ' block-pr-not-on-main'
2+ description : ' Blocks PRs from main branch of forked repository'
3+ runs :
4+ using : " composite"
5+ steps :
6+ - name : Ensure PR is not on main branch
7+ shell : bash
8+ run : |
9+ echo "Repo: ${{ github.repository }}"
10+ echo "Head Repo: ${{ github.event.pull_request.head.repo.full_name }}"
11+ echo "Forked: ${{ github.event.pull_request.head.repo.fork }}"
12+ echo "Branch: ${{ github.event.pull_request.head.ref }}"
13+
14+ if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ] && [ "${{ github.event.pull_request.head.ref }}" == 'main' ]; then
15+ echo "PRs from the main branch of forked repositories are not allowed."
16+ exit 1
17+ fi
Original file line number Diff line number Diff line change 3535
3636 - name : Lint
3737 run : make lint
38+
39+ - name : Ensure PR is not on main branch
40+ uses : ./.github/actions/block-pr-not-on-main
You can’t perform that action at this time.
0 commit comments