chore: enforce dev base branch and gitignore build artifacts (#2108)

* chore: enforce dev base branch and gitignore build artifacts

Two recurring contributor mistakes are now blocked at the tooling layer:

1. PRs targeting main instead of dev — the new `base-branch-check` job in
   pr-check.yml fails CI immediately with a one-line fix command.

2. dist/ and bridge/ build artifacts in PRs — added to .gitignore so they
   no longer appear as uncommitted changes after `npm run build`.

.github/CLAUDE.md also documents both rules so AI-assisted contributors
pick them up at session start, before they can make the mistake.

Directive: dist/ and bridge/ are generated by `npm run build` — never commit them.
Directive: all PRs must target `dev`; `main` is merged into by release workflow only.

* fix(ci): rerun base-branch-check on PR base edits

Add `edited` to the pull_request event types so the base-branch-check
job fires when a contributor changes their PR base via gh pr edit --base dev,
preventing stale failed statuses after the fix is applied.

Confidence: high
Scope-risk: narrow
This commit is contained in:
Ethan Stark
2026-04-03 04:58:27 -04:00
committed by GitHub
parent d31b32c242
commit f8b4224029
3 changed files with 27 additions and 1 deletions

6
.github/CLAUDE.md vendored
View File

@@ -108,6 +108,12 @@ Kill switches: `DISABLE_OMC`, `OMC_SKIP_HOOKS` (comma-separated).
State: `.omc/state/`, `.omc/state/sessions/{sessionId}/`, `.omc/notepad.md`, `.omc/project-memory.json`, `.omc/plans/`, `.omc/research/`, `.omc/logs/`
</worktree_paths>
<contribution_rules>
**PRs must always target `dev`, never `main`.** `main` is release-only and is only ever merged into by the maintainer via the release workflow. If you open a PR and realize it targets `main`, use `gh pr edit --base dev` to fix it before asking for review.
**Never commit `dist/` or `bridge/`.** These are build artifacts generated by `npm run build`. They are gitignored. If they appear in your diff, run `git restore dist/ bridge/` before committing. Committing them inflates PR size, creates merge conflicts, and obscures the actual changes under review.
</contribution_rules>
## Setup
Say "setup omc" or run `/oh-my-claudecode:omc-setup`.

View File

@@ -2,7 +2,7 @@ name: PR Check
on:
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, edited]
workflow_dispatch:
permissions:
@@ -63,6 +63,22 @@ jobs:
console.log(`PR Stats: +${additions} -${deletions} (${changedFiles} files) → ${sizeLabel}`);
base-branch-check:
name: Base Branch Check
runs-on: ubuntu-latest
steps:
- name: Require dev base branch
uses: actions/github-script@v7
with:
script: |
const base = context.payload.pull_request.base.ref;
if (base !== 'dev') {
core.setFailed(
`PRs must target the \`dev\` branch, not \`${base}\`. ` +
`Fix with: gh pr edit ${context.issue.number} --base dev`
);
}
draft-check:
name: Draft PR Check
runs-on: ubuntu-latest

4
.gitignore vendored
View File

@@ -24,3 +24,7 @@ benchmarks/harsh-critic/scoring/*.d.ts.map
# Release body is generated dynamically — never commit stale copies
.github/release-body.md
# Build artifacts — generated by `npm run build`, never commit
dist/
bridge/