Skip to content

Commit a934ccc

Browse files
authored
Add CanAdminsBypass to Environment (#2721)
Fixes: #2722.
1 parent 795005a commit a934ccc

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

github/github-accessors.go

Lines changed: 8 additions & 0 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: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/repos_environments.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Environment struct {
2828
HTMLURL *string `json:"html_url,omitempty"`
2929
CreatedAt *Timestamp `json:"created_at,omitempty"`
3030
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
31+
CanAdminsBypass *bool `json:"can_admins_bypass,omitempty"`
3132
ProtectionRules []*ProtectionRule `json:"protection_rules,omitempty"`
3233
}
3334

github/repos_environments_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func TestRepositoriesService_GetEnvironment(t *testing.T) {
145145

146146
mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) {
147147
testMethod(t, r, "GET")
148-
fmt.Fprint(w, `{"id": 1,"name": "staging", "deployment_branch_policy": {"protected_branches": true, "custom_branch_policies": false}}`)
148+
fmt.Fprint(w, `{"id": 1,"name": "staging", "deployment_branch_policy": {"protected_branches": true, "custom_branch_policies": false}, "can_admins_bypass": false}`)
149149
})
150150

151151
ctx := context.Background()
@@ -154,7 +154,7 @@ func TestRepositoriesService_GetEnvironment(t *testing.T) {
154154
t.Errorf("Repositories.GetEnvironment returned error: %v\n%v", err, resp.Body)
155155
}
156156

157-
want := &Environment{ID: Int64(1), Name: String("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: Bool(true), CustomBranchPolicies: Bool(false)}}
157+
want := &Environment{ID: Int64(1), Name: String("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: Bool(true), CustomBranchPolicies: Bool(false)}, CanAdminsBypass: Bool(false)}
158158
if !cmp.Equal(release, want) {
159159
t.Errorf("Repositories.GetEnvironment returned %+v, want %+v", release, want)
160160
}

0 commit comments

Comments
 (0)