Skip to content

Commit ccf1ade

Browse files
authored
Merge pull request hub4j#1732 from gheine/main
Add missing branch protection fields
2 parents 88a81b3 + 5c2fd6c commit ccf1ade

File tree

6 files changed

+487
-21
lines changed

6 files changed

+487
-21
lines changed

src/main/java/org/kohsuke/github/GHBranchProtection.java

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,30 @@
2222
public class GHBranchProtection extends GitHubInteractiveObject {
2323
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";
2424

25+
@JsonProperty
26+
private AllowDeletions allowDeletions;
27+
28+
@JsonProperty
29+
private AllowForcePushes allowForcePushes;
30+
31+
@JsonProperty
32+
private AllowForkSyncing allowForkSyncing;
33+
34+
@JsonProperty
35+
private BlockCreations blockCreations;
36+
2537
@JsonProperty
2638
private EnforceAdmins enforceAdmins;
2739

40+
@JsonProperty
41+
private LockBranch lockBranch;
42+
43+
@JsonProperty
44+
private RequiredConversationResolution requiredConversationResolution;
45+
46+
@JsonProperty
47+
private RequiredLinearHistory requiredLinearHistory;
48+
2849
@JsonProperty("required_pull_request_reviews")
2950
private RequiredReviews requiredReviews;
3051

@@ -59,6 +80,42 @@ public void disableSignedCommits() throws IOException {
5980
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send();
6081
}
6182

83+
/**
84+
* Gets allow deletions.
85+
*
86+
* @return the enforce admins
87+
*/
88+
public AllowDeletions getAllowDeletions() {
89+
return allowDeletions;
90+
}
91+
92+
/**
93+
* Gets allow force pushes.
94+
*
95+
* @return the enforce admins
96+
*/
97+
public AllowForcePushes getAllowForcePushes() {
98+
return allowForcePushes;
99+
}
100+
101+
/**
102+
* Gets allow fork syncing.
103+
*
104+
* @return the enforce admins
105+
*/
106+
public AllowForkSyncing getAllowForkSyncing() {
107+
return allowForkSyncing;
108+
}
109+
110+
/**
111+
* Gets block creations.
112+
*
113+
* @return the enforce admins
114+
*/
115+
public BlockCreations getBlockCreations() {
116+
return blockCreations;
117+
}
118+
62119
/**
63120
* Gets enforce admins.
64121
*
@@ -68,6 +125,33 @@ public EnforceAdmins getEnforceAdmins() {
68125
return enforceAdmins;
69126
}
70127

128+
/**
129+
* Gets lock branch.
130+
*
131+
* @return the enforce admins
132+
*/
133+
public LockBranch getLockBranch() {
134+
return lockBranch;
135+
}
136+
137+
/**
138+
* Gets required conversation resolution.
139+
*
140+
* @return the enforce admins
141+
*/
142+
public RequiredConversationResolution getRequiredConversationResolution() {
143+
return requiredConversationResolution;
144+
}
145+
146+
/**
147+
* Gets required linear history.
148+
*
149+
* @return the enforce admins
150+
*/
151+
public RequiredLinearHistory getRequiredLinearHistory() {
152+
return requiredLinearHistory;
153+
}
154+
71155
/**
72156
* Gets required reviews.
73157
*
@@ -120,6 +204,74 @@ private Requester requester() {
120204
return root().createRequest().withPreview(ZZZAX);
121205
}
122206

207+
/**
208+
* The type AllowDeletions.
209+
*/
210+
public static class AllowDeletions {
211+
@JsonProperty
212+
private boolean enabled;
213+
214+
/**
215+
* Is enabled boolean.
216+
*
217+
* @return the boolean
218+
*/
219+
public boolean isEnabled() {
220+
return enabled;
221+
}
222+
}
223+
224+
/**
225+
* The type AllowForcePushes.
226+
*/
227+
public static class AllowForcePushes {
228+
@JsonProperty
229+
private boolean enabled;
230+
231+
/**
232+
* Is enabled boolean.
233+
*
234+
* @return the boolean
235+
*/
236+
public boolean isEnabled() {
237+
return enabled;
238+
}
239+
}
240+
241+
/**
242+
* The type AllowForkSyncing.
243+
*/
244+
public static class AllowForkSyncing {
245+
@JsonProperty
246+
private boolean enabled;
247+
248+
/**
249+
* Is enabled boolean.
250+
*
251+
* @return the boolean
252+
*/
253+
public boolean isEnabled() {
254+
return enabled;
255+
}
256+
}
257+
258+
/**
259+
* The type BlockCreations.
260+
*/
261+
public static class BlockCreations {
262+
@JsonProperty
263+
private boolean enabled;
264+
265+
/**
266+
* Is enabled boolean.
267+
*
268+
* @return the boolean
269+
*/
270+
public boolean isEnabled() {
271+
return enabled;
272+
}
273+
}
274+
123275
/**
124276
* The type EnforceAdmins.
125277
*/
@@ -149,17 +301,73 @@ public boolean isEnabled() {
149301
}
150302
}
151303

304+
/**
305+
* The type LockBranch.
306+
*/
307+
public static class LockBranch {
308+
@JsonProperty
309+
private boolean enabled;
310+
311+
/**
312+
* Is enabled boolean.
313+
*
314+
* @return the boolean
315+
*/
316+
public boolean isEnabled() {
317+
return enabled;
318+
}
319+
}
320+
321+
/**
322+
* The type RequiredConversationResolution.
323+
*/
324+
public static class RequiredConversationResolution {
325+
@JsonProperty
326+
private boolean enabled;
327+
328+
/**
329+
* Is enabled boolean.
330+
*
331+
* @return the boolean
332+
*/
333+
public boolean isEnabled() {
334+
return enabled;
335+
}
336+
}
337+
338+
/**
339+
* The type RequiredLinearHistory.
340+
*/
341+
public static class RequiredLinearHistory {
342+
@JsonProperty
343+
private boolean enabled;
344+
345+
/**
346+
* Is enabled boolean.
347+
*
348+
* @return the boolean
349+
*/
350+
public boolean isEnabled() {
351+
return enabled;
352+
}
353+
}
354+
152355
/**
153356
* The type RequiredReviews.
154357
*/
155358
public static class RequiredReviews {
156359
@JsonProperty("dismissal_restrictions")
157360
private Restrictions dismissalRestriction;
158361

362+
@JsonProperty
159363
private boolean dismissStaleReviews;
160364

365+
@JsonProperty
161366
private boolean requireCodeOwnerReviews;
162367

368+
@JsonProperty
369+
private boolean requireLastPushApproval;
370+
163371
@JsonProperty("required_approving_review_count")
164372
private int requiredReviewers;
165373

@@ -202,6 +410,15 @@ public boolean isRequireCodeOwnerReviews() {
202410
return requireCodeOwnerReviews;
203411
}
204412

413+
/**
414+
* Is require last push approval boolean.
415+
*
416+
* @return the boolean
417+
*/
418+
public boolean isRequireLastPushApproval() {
419+
return requireLastPushApproval;
420+
}
421+
205422
/**
206423
* Gets required reviewers.
207424
*

0 commit comments

Comments
 (0)