This repository contains GitHub rulesets configurations for managing branch protection and repository policies. As a collection of ruleset templates, I maintain strict development practices to ensure these configurations remain reliable and up-to-date.
I follow a strict Gitflow workflow to maintain a clean and organized codebase:
main: Core branch with the latest shippable ruleset configurations. This branch is protected and receives merges fromdevelop.develop: Integration branch for ongoing development of new rulesets or updates. This branch maintains linear history.feature/*: Branches for developing new ruleset capabilities. Create fromdevelopand squash-merge back todevelop.fix/*: Branches for bug fixes or ruleset improvements. Create fromdevelopand squash-merge back todevelop.release/*: Branches for preparing a new version. Create fromdevelop, make release changes, then squash-merge intodevelop. Finally mergedeveloptomainfor release.
- Signed Commits: All commits must be signed using
git commit -sorgit commit --signoff. - Linear History:
developbranch: Maintains linear history through squash merges from feature branches.mainbranch: Receives regular merges fromdevelop, creating non-linear history.
- Merge Strategy:
- Feature branches →
develop: Squash and merge develop→main: Regular merge (not squashed)
- Feature branches →
- Commit Messages: Write clear, concise commit messages that describe what was changed and why.
- Tagging: Create tags on the
mainbranch to mark official releases. Tags should point to the merge commit fromdeveloptomain.
- Create a feature or fix branch from
develop. - Make changes and test thoroughly.
- Rebase onto the latest
developto resolve conflicts. - Squash commits into meaningful units.
- Squash-merge back to
developvia a pull request. - When ready for release:
- Create a
release/*branch fromdevelop - Make any final release preparations
- Squash-merge the
release/*branch back todevelop - Then merge
developtomain(regular merge, not squashed) - Create a tag on the
mainbranch at the merge commit to mark the official release
- Create a
Ruleset for the main branch with the following rules:
- Deletion: Prevents deletion of the branch
- Non-fast-forward: Requires linear history (no force pushes)
- Required Signatures: All commits must be signed
- Pull Request: Requires 1 approving review, allows squash merges only
- Required Linear History: Enforces linear commit history
Ruleset for the develop branch with identical rules to main.json:
- Deletion: Prevents deletion of the branch
- Non-fast-forward: Requires linear history (no force pushes)
- Required Signatures: All commits must be signed
- Pull Request: Requires 1 approving review, allows squash merges only
- Required Linear History: Enforces linear commit history
This repository has the following additional settings enabled:
-
Require contributors to sign off on web-based commits: Contributors must sign off on commits made through GitHub's web interface, affirming compliance with the Developer Certificate of Origin (DCO).
-
Issues: Lightweight task tracking is enabled with issue labels and milestones.
-
Allow squash merging: Pull requests can be merged by combining all commits into a single commit.
-
Default commit message: A default message is presented when merging pull requests with squash.
-
Always suggest updating pull request branches: When new changes are available in the base branch, an "update branch" option is presented.
-
Automatically delete head branches: Merged pull request branches are automatically deleted (but can be restored).
-
Auto-close issues with merged linked pull requests: Issues are automatically closed when their linked pull requests are merged.
These ruleset configurations can be used as templates or examples for your own repositories. To apply them:
- Copy the JSON content from the appropriate file
- Go to your repository's Settings > Rules > Rulesets
- Create a new ruleset and paste the JSON configuration
- Adjust the
sourcefield to match your repository - Customize rules as needed for your workflow
I use GitHub issues to track tasks. Issue templates are available:
See CONTRIBUTING.md for detailed contribution guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.