Skip to content

Instantly share code, notes, and snippets.

@richbl
Created June 19, 2026 00:39
Show Gist options
  • Select an option

  • Save richbl/44a92b5b91c8a3763c1636616ed9dc33 to your computer and use it in GitHub Desktop.

Select an option

Save richbl/44a92b5b91c8a3763c1636616ed9dc33 to your computer and use it in GitHub Desktop.
Branch protection for MAIN branch following the Github Flow Pattern
{
"name": "GitHub Flow Pattern: Protect MAIN",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"~DEFAULT_BRANCH"
]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "required_signatures"
},
{
"type": "required_linear_history"
},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 1,
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": false,
"require_last_push_approval": false,
"required_review_thread_resolution": true,
"allowed_merge_methods": [
"squash"
]
}
},
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": false,
"required_status_checks": [
{
"context": "CodeQL",
"integration_id": 57789
},
{
"context": "DCO",
"integration_id": 1861
},
{
"context": "Codacy Static Code Analysis",
"integration_id": 56611
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment