Add missing fields to BranchProtection and related structs #626

Merged
jolheiser merged 2 commits from :add-branch-protection-rule-name into main 2023-08-01 16:26:43 +00:00
Contributor

the gitea.BranchProtection struct is missing some fields which are present in the actual gitea API (and swagger).

  • BranchProtection.RuleName was added in gitea v1.19.0, via PR #20825
  • BranchProtection.UnprotectedFilePatterns was added in gitea v1.16.0, via PR #16395

This PR adds those fields to the BranchProtection struct, and the related Create and Edit option structs, to match the structs defined on the gitea server side.

the `gitea.BranchProtection` struct is missing some fields which are present in the actual gitea API (and swagger). * BranchProtection.RuleName was added in gitea v1.19.0, via [PR #20825](https://github.com/go-gitea/gitea/pull/20825) * BranchProtection.UnprotectedFilePatterns was added in gitea v1.16.0, via [PR #16395](https://github.com/go-gitea/gitea/pull/16395) This PR adds those fields to the BranchProtection struct, and the related Create and Edit option structs, to match the structs [defined](https://github.com/go-gitea/gitea/blob/main/modules/structs/repo_branch.go#L27) on the gitea server side.
Author
Contributor

By the way, your PR template needs an update. It says:

  1. Make sure you are targeting the master branch, pull requests on release branches are only allowed for bug fixes.

However, the default branch for go-sdk seems to be main, not master.

By the way, your PR template needs an update. It says: > 1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes. However, the default branch for go-sdk seems to be `main`, not `master`.
jolheiser reviewed 2023-08-01 14:47:23 +00:00
@ -86,6 +90,7 @@ type EditBranchProtectionOption struct {
DismissStaleApprovals *bool `json:"dismiss_stale_approvals"`
RequireSignedCommits *bool `json:"require_signed_commits"`
ProtectedFilePatterns *string `json:"protected_file_patterns"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns"`
Owner

This should likely be a pointer so that nil is usable and doesn't marshal an empty string.

This should likely be a pointer so that `nil` is usable and doesn't marshal an empty string.
Author
Contributor

Fixed. Good catch, thanks.

Fixed. Good catch, thanks.
infinoid marked this conversation as resolved
infinoid force-pushed add-branch-protection-rule-name from ef0cc2820c to fbfdb2173a 2023-08-01 16:01:23 +00:00 Compare
jolheiser approved these changes 2023-08-01 16:05:32 +00:00
delvh approved these changes 2023-08-01 16:19:56 +00:00
infinoid force-pushed add-branch-protection-rule-name from fbfdb2173a to 7dd8441d0b 2023-08-01 16:23:45 +00:00 Compare
Author
Contributor

I rebased to current main.

I rebased to current main.
jolheiser merged commit ae1583a7be into main 2023-08-01 16:26:43 +00:00
infinoid deleted branch add-branch-protection-rule-name 2023-08-01 16:32:57 +00:00
Sign in to join this conversation.
No description provided.