Skip to content

Commit

Permalink
Fix JSON protection unmarshal error (#2606)
Browse files Browse the repository at this point in the history
  • Loading branch information
xorima authored Dec 26, 2022
1 parent 2b4d596 commit c5d656a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 22 deletions.
36 changes: 26 additions & 10 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 22 additions & 8 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,10 +843,18 @@ type Protection struct {
AllowForcePushes *AllowForcePushes `json:"allow_force_pushes"`
AllowDeletions *AllowDeletions `json:"allow_deletions"`
RequiredConversationResolution *RequiredConversationResolution `json:"required_conversation_resolution"`
// LockBranch represents if the branch is marked as read-only. If this is true, users will not be able to push to the branch.
LockBranch *bool `json:"lock_branch,omitempty"`
// AllowForkSyncing represents whether users can pull changes from upstream when the branch is locked.
AllowForkSyncing *bool `json:"allow_fork_syncing,omitempty"`
LockBranch *LockBranch `json:"lock_branch,omitempty"`
AllowForkSyncing *AllowForkSyncing `json:"allow_fork_syncing,omitempty"`
}

// LockBranch represents if the branch is marked as read-only. If this is true, users will not be able to push to the branch.
type LockBranch struct {
Enabled *bool `json:"enabled,omitempty"`
}

// AllowForkSyncing represents whether users can pull changes from upstream when the branch is locked.
type AllowForkSyncing struct {
Enabled *bool `json:"enabled,omitempty"`
}

// BranchProtectionRule represents the rule applied to a repositories branch.
Expand Down

0 comments on commit c5d656a

Please sign in to comment.