feat: add additional branch protection flags, closes #51#59
Merged
Conversation
…closes #51 Co-authored-by: Copilot <copilot@github.com>
Contributor
Coverage |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the branch-protection feature to support additional GitLab protected-branch flags and updates config parsing/docs/tests to match.
Changes:
- Add
allowForcePushandcodeOwnerApprovalRequiredtoBranchRuleand surface them inAssignmentConfig.Show(). - Forward the new flags through to GitLab’s protected-branch create (POST) and update (PATCH) calls.
- Improve config parsing to accept legacy snake_case keys for the new flags and add contract/unit tests covering the behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
gitlab/protect.go |
Pass BranchRule through to protection logic and forward additional protection flags to GitLab API options. |
gitlab/protect_contract_test.go |
Add contract tests asserting the new flags are sent on both create and update paths; update protectSingleBranch callsites for new signature. |
gitlab/contract_test_helpers_test.go |
Configure the GitLab API client for tests to avoid retries that could hang against mock 5xx responses. |
config/types.go |
Extend BranchRule with AllowForcePush and CodeOwnerApprovalRequired. |
config/repo.go |
Decode branches with a custom mapstructure decoder and normalize legacy snake_case keys for the new flags; merge duplicate branch rules including new flags. |
config/repo_test.go |
Add coverage for merging the new flags and for legacy snake_case config keys. |
config/show.go |
Print the two new branch flags in Show() output. |
config/urls_show_test.go |
Assert Show() output includes the new compact branch flags. |
docs/configuration.md |
Document the new branch keys and add them to examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.