feat(just): Add repository branch protection justfile entries #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds justfile entries for protecting GitHub repositories using branch rulesets, and refactors the entire justfile to use just built-in functions and a global
target_repovariable.Changes
New Features
Branch Protection Recipes: New justfile recipes for managing repository branch protection:
protect-repo [repo]- Apply all branch protection rulesetsapply-ruleset [repo] <file>- Apply a single ruleset from JSON fileunprotect-repo [repo]- Remove all rulesetslist-rulesets [repo]- List all rulesets for a repositoryInitialization System:
init- Interactive first-time setup that setstarget_reposet-target <repo>- Non-interactive way to change target repositoryNew Files
.github/rulesets/main-branch-protection.json- Ruleset configuration for main branch.github/rulesets/integration-branch-protection.json- Ruleset configuration for integration branch.ai/docs/strategies/protect-github-repo.md- Strategy documentationRefactoring
Built-in Functions: Replaced shell patterns with just built-ins:
justfile_directory()instead of$(dirname "$0")justfile()for self-modificationpath_exists()for file/directory validationerror()for clean error handlingGlobal Variables:
target_repo- set viainitor override per-commandjustfile_dir,labels_file,rulesets_dir,bundles_dirpath variablesValidation Helpers:
_require-repo- Ensures repo parameter is set_require-file- Ensures file exists_require-dir- Ensures directory existsCode Cleanup:
echo ""statements[private]Protection Rules Applied
Main Branch
Integration Branch
Usage
Commits
feat(just): Adding justfile entries for protecting repositorydocs(just): Documenting justfile entries for protecting repositoryrefactor(just): Use built-in functions, add init recipe, and target_repo default