11# Branch Protection And CI Roles
22
3- This repository uses three CI layers with different responsibilities:
3+ This repository uses three primary CI/CD layers with different responsibilities:
44
55- ` PR Gate ` : the pre-merge blocking gate for ` main `
66- ` Main Post-Merge ` : post-merge validation for merge-result health and advisory supply-chain checks
77- ` Release ` : tag-based release preparation and draft release creation
88
9+ There is also one source-security workflow managed alongside the CI layers:
10+
11+ - ` CodeQL ` : source code security scanning for PRs to ` main ` and pushes to ` main `
12+
13+ There is also one optional developer workflow:
14+
15+ - ` Dev Fast CI ` : lightweight self-checks for non-` main ` development branches
16+
917Related workflows:
1018
1119- ` .github/workflows/pr-gate.yml `
20+ - ` .github/workflows/_quality-gate.yml `
1221- ` .github/workflows/main-post-merge.yml `
22+ - ` .github/workflows/codeql.yml `
23+ - ` .github/workflows/dev-fast-ci.yml `
1324- ` .github/workflows/release.yml `
1425- ` .github/workflows/publish-images.yml `
1526
1627## What Should Block Merge
1728
18- Only the PR gate should be configured as the required branch-protection check for ` main ` .
29+ Only the PR gate should be configured as the required branch-protection check set for ` main ` .
30+
31+ Recommended required check targets:
32+
33+ - ` PR Gate / Quality Gate / Lint (pull_request) `
34+ - ` PR Gate / Quality Gate / Test Backend (pull_request) `
35+ - ` PR Gate / Quality Gate / Test Frontend (pull_request) `
36+ - ` PR Gate / Quality Gate / Security Scan (pull_request) `
37+ - ` PR Gate / Quality Gate / E2E Smoke (pull_request) `
1938
20- Recommended required check target :
39+ Optional later additions after the first successful CodeQL PR runs :
2140
22- - workflow: ` PR Gate `
23- - job: ` Quality Gate `
41+ - the real reported CodeQL PR job checks, such as the Go and JavaScript TypeScript analysis jobs
2442
2543Why:
2644
27- - It is the main admission gate for code entering ` main ` .
28- - It runs lint, tests, security fast checks, and e2e smoke.
29- - It avoids using post-merge or release-only checks as pre-merge blockers.
45+ - ` PR Gate ` is the main admission gate for code entering ` main `
46+ - it runs lint, tests, security fast checks, and e2e smoke
47+ - it avoids using post-merge or release-only checks as pre-merge blockers
48+ - GitHub branch protection must reference the real job-level checks reported by workflows, not abstract wrapper names like ` PR Gate ` or ` Quality Gate `
49+
50+ Do not set these as required checks unless matching workflows are actually reporting them:
51+
52+ - ` PR Gate `
53+ - ` Quality Gate `
54+ - ` Code scanning results `
55+
56+ ## Developer Branch Fast CI
57+
58+ ` Dev Fast CI ` is intended for personal development branches and excludes ` main ` .
59+
60+ It is useful for early feedback, but it is not a merge-governance layer and should not replace the PR gate.
61+
62+ Recommended use:
63+
64+ - run lightweight lint, backend/frontend tests, and fast security checks on ` push -> non-main branches `
65+ - do not treat ` Dev Fast CI ` as a required check for ` main `
66+ - do not use it as a substitute for PR review or branch protection
3067
3168## What Should Not Block Merge
3269
@@ -55,8 +92,9 @@ Enable:
5592
5693Recommended manual settings outside the repository:
5794
58- - set ` PR Gate / Quality Gate ` as a required status check
59- - require at least one human approval
95+ - set the five PR job checks listed above as required status checks
96+ - after the first successful CodeQL runs, optionally add the real reported CodeQL PR check names if you want source security scanning to block merges
97+ - require at least one human approval when the repository has more than one active maintainer
6098- add CODEOWNERS later for sensitive areas such as workflows, release logic, and runtime bootstrapping
6199
62100## How To Treat AI In Branch Protection
@@ -76,4 +114,29 @@ Release workflows are not part of the merge gate.
76114- ` Release ` validates tags, generates release artifacts, and creates a draft release
77115- ` Publish Images ` runs only after a release is published
78116
79- This separation avoids using release-specific work as a daily development bottleneck.
117+ This separation avoids using release-specific work as a daily development bottleneck.
118+
119+ ## Current Code Scanning State
120+
121+ There is a dedicated repository-managed CodeQL workflow in ` .github/workflows/codeql.yml ` .
122+
123+ What exists right now:
124+
125+ - ` CodeQL ` runs for ` pull_request -> main `
126+ - ` CodeQL ` runs for ` push -> main `
127+ - ` Main Post-Merge ` runs an advisory Trivy image scan
128+ - the Trivy SARIF report is uploaded to GitHub Security using ` github/codeql-action/upload-sarif@v3 `
129+ - the Trivy SARIF upload happens after pushes to ` main ` , not as a PR gate
130+
131+ What this means operationally:
132+
133+ - PRs to ` main ` now produce dedicated CodeQL checks and code scanning results
134+ - pushes to ` main ` continue to refresh the default-branch code scanning baseline
135+ - branch protection should use the real CodeQL job check names after they appear, not the generic label ` Code scanning results `
136+ - Trivy image scanning remains a post-merge image-security signal, not a source-code scanning gate
137+
138+ Recommended interpretation:
139+
140+ - CodeQL is the source-code security layer
141+ - Trivy image scanning is the post-merge image-security layer
142+ - these are complementary and should not be treated as the same check type
0 commit comments