Skip to content

ci: add main branch guard workflow - #44

Merged
bradygaster merged 1 commit into
mainfrom
dev
Feb 13, 2026
Merged

bradygaster merged 1 commit into
mainfrom
dev

Conversation

@bradygaster

@bradygaster bradygaster commented Feb 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a GitHub Actions workflow (squad-main-guard.yml) that blocks PRs to main from containing forbidden paths:

  • .ai-team/** — ALL team state files, zero exceptions
  • team-docs/** — internal team content (except team-docs/blog/**, which is allowed)

Why

.ai-team/ files (121+ team state files) have repeatedly leaked into main via PR merges from dev. Even though .ai-team/ is in .gitignore, files previously force-added with git add -f remain tracked and flow through merges. .gitignore is a request — CI is enforcement.

How it works

  1. Triggers on pull_request targeting main (opened, synchronize, reopened)
  2. Uses the GitHub API (pulls.listFiles) to get the full list of changed files in the PR
  3. Checks each file against the forbidden path rules
  4. Fails with a clear error listing forbidden files and exact fix commands
  5. Passes silently if no forbidden files are found

Files changed

  • templates/workflows/squad-main-guard.yml — reusable template for distribution
  • .github/workflows/squad-main-guard.yml — active on this repo
  • .gitignore — updated with explicit warning against force-adding .ai-team/

Error output example

When forbidden files are detected, the contributor sees:

  • Exactly which files are forbidden
  • Why they're forbidden
  • The exact git rm --cached commands to fix it

- Add squad-main-guard.yml workflow that fails PRs to main containing:
  - .ai-team/** (all team state files, zero exceptions)
  - team-docs/** except team-docs/blog/** (blog is allowed)
- Uses GitHub API (pulls.listFiles) for accurate PR file detection
- Error message includes exact fix commands (git rm --cached)
- Placed in both templates/workflows/ and .github/workflows/
- Updated .gitignore with explicit warning against force-adding .ai-team/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant