This directory contains automated configuration for the GitHub repository, including branch protection rules, security settings, and repository policies.
repository-config.json- Complete repository configuration including branch protection rulessetup-repository.ps1- PowerShell script to apply configuration via GitHub CLIworkflows/ci.yml- GitHub Actions CI/CD pipeline
-
Install GitHub CLI:
winget install GitHub.cli
-
Authenticate with GitHub:
gh auth login
# Dry run to see what would be applied
.\.github\setup-repository.ps1 -DryRun
# Apply all settings
.\.github\setup-repository.ps1
# Apply only repository settings (skip branch protection)
.\.github\setup-repository.ps1 -SkipBranchProtection- ✅ Require pull request reviews (1 approver required)
- ✅ Require status checks (CI/CD pipeline must pass)
- ✅ Dismiss stale reviews on new commits
- ✅ Require conversation resolution before merge
- ✅ Enforce for administrators (no exceptions)
- ✅ Block force pushes and deletions
- ✅ Require branches to be up to date
CI/CD Pipeline / test- Unit tests must passCI/CD Pipeline / security-scan- Security scan must passCI/CD Pipeline / build- Build must succeed
- ✅ Squash merge enabled (clean history)
- ❌ Merge commits disabled (avoid noise)
- ✅ Rebase merge enabled (linear history)
- ✅ Delete branch on merge (clean up)
- ✅ Auto-merge when conditions met
- ✅ Secret scanning enabled
- ✅ Secret scanning push protection enabled
- ✅ Vulnerability alerts enabled
- ✅ Dependency graph enabled
- ✅ Dependabot security updates enabled
powershellwindows-11system-maintenanceautomationgaming-workstationwindows-optimizationpowershell-scriptssystem-administration
If the automated script doesn't work, you can manually configure via GitHub web interface:
- Go to Settings → Branches
- Click Add rule for
masterbranch - Enable all the protections listed above
- Go to Settings → Code security and analysis
- Enable all security features
Authentication Error:
gh auth login
# Follow the prompts to authenticatePermission Error:
- Ensure you're the repository owner or have admin access
- Check that your GitHub token has the required scopes
API Rate Limiting:
- Wait a few minutes and retry
- The script includes automatic retry logic
After running the setup script, verify the configuration:
# Check branch protection
gh api repos/justinkowarsch/windows-system-maintenance/branches/master/protection
# Check repository settings
gh repo view justinkowarsch/windows-system-maintenance
# Test the protection by trying to push directly to master (should fail)
git push origin master # This should be blocked!With branch protection enabled, the workflow becomes:
- Create feature branch:
git checkout -b feature/my-feature - Make changes and commit:
git commit -m "Add feature" - Push branch:
git push origin feature/my-feature - Create pull request via GitHub web interface
- Wait for CI checks to pass (tests, security scan, build)
- Get review approval (1 required)
- Merge via GitHub (squash merge recommended)
Direct pushes to master are now blocked for everyone (including repository owner)!