Skip to content

feat: guard main against direct-from-feature-branch PRs - #82

Merged
ss-o merged 1 commit into
nextfrom
feature-81
Jul 24, 2026
Merged

feat: guard main against direct-from-feature-branch PRs#82
ss-o merged 1 commit into
nextfrom
feature-81

Conversation

@ss-o

@ss-o ss-o commented Jul 24, 2026

Copy link
Copy Markdown
Member

Adds .github/workflows/main-branch-guard.yml: a required-status-check workflow that fails a pull request targeting main unless its head branch is next or matches hotfix-*, per ADR-0008's next -> main branching model (z-shell/.github).

This addresses the root cause of #79: PRs #66, #67, #72, #73 were merged directly into main from feature branches, bypassing next, which is what caused main and next to diverge.

This PR only adds the check. Wiring it into main's ruleset as a required status check is a follow-up, once the check has run at least once on a real PR against main (needed so GitHub has a context to reference).

Closes #81

Test plan

  • YAML validated with python3 -c "import yaml; yaml.safe_load(...)"
  • Trunk Code Quality: no issues

Adds a required-status-check workflow that fails a pull request
targeting main unless its head branch is next or matches hotfix-*,
per ADR-0008's next -> main branching model (z-shell/.github). This
is a required status check, not a full enforcement by itself; wiring
it into main's ruleset is a follow-up once the check has run at least
once on a real PR.

Closes #81
Copilot AI review requested due to automatic review settings July 24, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow intended to enforce the repo’s next -> main (and hotfix-* -> main) branching model by failing pull requests that target main from disallowed source branches.

Changes:

  • Introduce a new workflow that runs on PRs targeting main and validates the PR head branch name (next or hotfix-*).
  • Add concurrency settings to avoid redundant runs per PR.

Comment on lines +21 to +30
- name: Verify pull request source branch
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ "${HEAD_REF}" == "next" || "${HEAD_REF}" == hotfix-* ]]; then
echo "Head branch '${HEAD_REF}' is allowed to target main."
exit 0
fi
echo "::error::Pull requests into main must come from 'next' or a 'hotfix-*' branch (got '${HEAD_REF}'). See ADR-0008 (z-shell/.github) for the branching model."
exit 1
@ss-o
ss-o merged commit c512125 into next Jul 24, 2026
5 checks passed
@ss-o
ss-o deleted the feature-81 branch July 24, 2026 07:31
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.

2 participants