Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 2.97 KB

File metadata and controls

100 lines (79 loc) · 2.97 KB

Next Branch Reconciliation - Implementation Summary

Problem

PR #19 was correctly merged to the next branch, but there was confusion about the branching strategy and a need to prevent future direct PRs to main.

Solution Implemented

1. Integrated Branch Protection into CI

Modified .github/workflows/ci.yaml to include:

  • New check-source-branch job that runs first on all PRs
  • Validates that PRs to main come only from next branch
  • Posts helpful comment explaining the violation
  • Blocks all other CI jobs if the check fails

2. Job Dependency Chain

All CI jobs now depend on check-source-branch:

check-source-branch (validates branch policy)
  ↓
lint-dockerfile, test, test-e2e, security
  ↓
release
  ↓
generate-sbom, deploy-docs, publish-pypi, publish-testpypi

This ensures:

  • Invalid PRs fail immediately
  • No resources wasted on tests/builds for invalid PRs
  • Clear feedback to contributors

3. Updated PR Triggers

Updated ci.yaml to accept PRs to both main and next:

pull_request:
  branches: [ main, next ]

4. Comprehensive Documentation

Created BRANCHING_STRATEGY.md with:

  • Complete workflow guide
  • Branch purposes and protection rules
  • Troubleshooting section
  • Benefits of the strategy

How It Works

For Valid PRs

Feature Branch → next ✅
- check-source-branch: ✅ skipped (not targeting main)
- All other jobs: ✅ run normally

next → main ✅  
- check-source-branch: ✅ passed (next to main is allowed)
- All other jobs: ✅ run normally

For Invalid PRs

Feature Branch → main ❌
- check-source-branch: ❌ FAILED
- All other jobs: ⏭️ SKIPPED (blocked by failed check)
- Comment posted: Explains how to fix

Key Features

  1. Automated Enforcement: No manual oversight needed
  2. Fast Feedback: Fails immediately, no wasted CI time
  3. Helpful Guidance: Automatic comment explains the issue
  4. Blocking: All downstream jobs depend on the check
  5. Flexible: Works for both main and next branches

Testing

The YAML syntax has been validated. The logic will be tested when:

  1. A PR is created from a feature branch to main (should fail)
  2. A PR is created from a feature branch to next (should pass)
  3. A PR is created from next to main (should pass)

Next Steps

  1. Merge this PR to establish the branching strategy
  2. Test by creating a test PR from a feature branch to main
  3. Configure GitHub branch protection rules (optional, but recommended)
  4. Update team documentation about the workflow

Files Changed

  • .github/workflows/ci.yaml - Added check-source-branch job, updated dependencies
  • BRANCHING_STRATEGY.md - New comprehensive guide
  • RECONCILIATION_SUMMARY.md - This file

Benefits

  • Prevents mistakes: Automatic enforcement before any human sees the PR
  • Saves time: Invalid PRs fail fast without running expensive tests
  • Clear guidance: Contributors know exactly what to do
  • No maintenance: No separate workflow file to maintain