name: Block Internal PRs on: pull_request: types: [opened, reopened] jobs: block-internal-prs: name: Block Internal PRs # Only run if PR is from the same repo (not a fork) if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Close PR and comment uses: actions/github-script@v7 with: script: | const prNumber = context.issue.number; const branch = context.payload.pull_request.head.ref; const body = [ '**Internal PRs are not allowed.**', '', 'Gas Town agents push directly to main. PRs are for external contributors only.', '', 'To land your changes:', '```bash', 'git checkout main', 'git merge ' + branch, 'git push origin main', 'git push origin --delete ' + branch, '```', '', 'See CLAUDE.md: "Crew workers push directly to main. No feature branches. NEVER create PRs."' ].join('\n'); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, body: body }); await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, state: 'closed' }); core.setFailed('Internal PR blocked. Push directly to main instead.');