Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# All files require review from the repository owner
* @leeoades
37 changes: 37 additions & 0 deletions .github/workflows/branch-protection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Apply Branch Protection

on:
workflow_dispatch:
push:
branches: [main]
paths: ['.github/workflows/branch-protection.yml']

permissions:
contents: read
administration: write

jobs:
protect-main:
runs-on: ubuntu-latest
steps:
- name: Apply main branch protection rules
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.repos.updateBranchProtection({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
required_status_checks: null,
enforce_admins: true,
required_pull_request_reviews: {
required_approving_review_count: 1,
dismiss_stale_reviews: true,
require_code_owner_reviews: true,
},
restrictions: null,
allow_force_pushes: false,
allow_deletions: false,
});
console.log('Branch protection rules applied to main.');