Protect main Branch, with Automated QA
This is a how-to Guide, with everything you need, to "protect" your
main branch, involved in release-me Phase 2 Git Ops Process.
Prerequisites
- a
github repository - account with permission to Repository Settings
Guide
-
Navigate to
in your Repository Settingson github.com
-
Click
branchesunderCode and Automation
-
Ensure there is
Rulethat matches themainname pattern -
Allow code merges in
mainonly via PR
-
Allow merges in
mainonly if latest commit (of head Branch) passed QA on CI-
Require (CI) Status Check on most recent commit

-
Wire-up your CI Checks into
Single QA Job, to modelAcceptance, with a logicalQAsignalTip
Typical CI Jobs
Unit Tests,Integration Tests,automated QA,Static Code Analysis,e2e,Functional TestsAdd in your CI/CD Workflow the
Single StatusJob. See examples below:name: 'CI/CD 3-Phases Pipeline' on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - run: echo "Build Finished :)" test: needs: build runs-on: ubuntu-latest # Unit Testing # Functional Testing steps: - run: echo "Test Finished :)" deploy: needs: test runs-on: ubuntu-latest steps: - run: echo "Deploy Finished :)" ### Git Ops: Check PR Acceptance ### qa_signal: needs: test uses: boromir674/automated-workflows/.github/workflows/go-single-status.yml@ffac270355ffe73cb8ab2bd2477ce6b20efca912 # v1.7.0 with: needs_json: '${{ toJson(needs) }}'name: 'CI/CD Pipeline' on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - run: echo "Build Finished :)" test: needs: build runs-on: ubuntu-latest # Unit Testing # Functional Testing steps: - run: echo "Test Finished :)" integration_tests: needs: build runs-on: ubuntu-latest steps: - run: echo "Test Integration Finished :)" deploy: needs: [test, integration_tests] runs-on: ubuntu-latest steps: - run: echo "Deploy Finished :)" ### Git Ops: Check PR Acceptance ### qa_signal: needs: [test, integration_tests] uses: boromir674/automated-workflows/.github/workflows/go-single-status.yml@ffac270355ffe73cb8ab2bd2477ce6b20efca912 # v1.7.0 with: needs_json: '${{ toJson(needs) }}'name: 'CI/CD Pipeline' on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - run: echo "Build Finished :)" test: needs: build runs-on: ubuntu-latest strategy: matrix: ['py311', 'py312'] steps: - run: echo "Test ${{ strategy.matrix }} Finished :)" integration_tests: needs: build runs-on: ubuntu-latest steps: - run: echo "Test Integration Finished :)" deploy: needs: [test, integration_tests] runs-on: ubuntu-latest steps: - run: echo "Deploy Finished :)" ### Git Ops: Check PR Acceptance ### qa_signal: needs: [test, integration_tests] uses: boromir674/automated-workflows/.github/workflows/go-single-status.yml@ffac270355ffe73cb8ab2bd2477ce6b20efca912 # v1.7.0 with: needs_json: '${{ toJson(needs) }}'name: 'CI/CD Pipeline' on: push: branches: - main jobs: test_1: runs-on: ubuntu-latest steps: - run: echo "Test 1 Finished :)" build: needs: test_1 runs-on: ubuntu-latest steps: - run: echo "Build Finished :)" test_2: needs: build runs-on: ubuntu-latest strategy: matrix: ['py311', 'py312'] steps: - run: echo "Test ${{ strategy.matrix }} Finished :)" deploy: needs: test_2 runs-on: ubuntu-latest steps: - run: echo "Deploy Finished :)" ### Git Ops: Check PR Acceptance ### qa_signal: needs: [test_1, test_2] uses: boromir674/automated-workflows/.github/workflows/go-single-status.yml@ffac270355ffe73cb8ab2bd2477ce6b20efca912 # v1.7.0 with: needs_json: '${{ toJson(needs) }}'Above shorthands
B,T,Dcorrespond to typicalBuild,Test,DeployCI/CD JobsTip
Shrinks the interfacing surface beween
Git Ops Acceptanceand yourCI/CDPipeline -
Include the
Single QA Jobin theRequired Status Checksthe Wire-up your CI Checks into Single QA Job
-
Congratulations!
You should now have protected your main branch according to Git Ops!