Gas Town agents must push directly to main, not create PRs. This adds defense-in-depth: 1. .githooks/pre-push - Blocks pushes to non-main branches locally 2. .github/workflows/block-internal-prs.yml - Auto-closes PRs from the same repo (forks/contributors can still create PRs) 3. internal/git/git.go - Auto-configures core.hooksPath on clone 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
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;
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: prNumber,
|
|
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."`
|
|
});
|
|
|
|
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.');
|