Skip to content

Commit c5d656a

Browse files
authored
Fix JSON protection unmarshal error (#2606)
1 parent 2b4d596 commit c5d656a

File tree

3 files changed

+60
-22
lines changed

3 files changed

+60
-22
lines changed

github/github-accessors.go

Lines changed: 26 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 22 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/repos.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,18 @@ type Protection struct {
843843
AllowForcePushes *AllowForcePushes `json:"allow_force_pushes"`
844844
AllowDeletions *AllowDeletions `json:"allow_deletions"`
845845
RequiredConversationResolution *RequiredConversationResolution `json:"required_conversation_resolution"`
846-
// LockBranch represents if the branch is marked as read-only. If this is true, users will not be able to push to the branch.
847-
LockBranch *bool `json:"lock_branch,omitempty"`
848-
// AllowForkSyncing represents whether users can pull changes from upstream when the branch is locked.
849-
AllowForkSyncing *bool `json:"allow_fork_syncing,omitempty"`
846+
LockBranch *LockBranch `json:"lock_branch,omitempty"`
847+
AllowForkSyncing *AllowForkSyncing `json:"allow_fork_syncing,omitempty"`
848+
}
849+
850+
// LockBranch represents if the branch is marked as read-only. If this is true, users will not be able to push to the branch.
851+
type LockBranch struct {
852+
Enabled *bool `json:"enabled,omitempty"`
853+
}
854+
855+
// AllowForkSyncing represents whether users can pull changes from upstream when the branch is locked.
856+
type AllowForkSyncing struct {
857+
Enabled *bool `json:"enabled,omitempty"`
850858
}
851859

852860
// BranchProtectionRule represents the rule applied to a repositories branch.

0 commit comments

Comments
 (0)