Skip to content

Commit 8adfe8f

Browse files
committed
Add --allowForcedPush to ProtectedBranchesScript
Test for gitlab4j/gitlab4j-api#1072
1 parent 7fdb450 commit 8adfe8f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gitlab4j-test/ProtectedBranchesScript.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22

33
//DEPS info.picocli:picocli:4.6.3
4-
//DEPS org.gitlab4j:gitlab4j-api:5.4.0
4+
//DEPS https://github.com/dpalic/gitlab4j-api/commit/7ad47ca0769bc88867208a1e2756d5e8d266e5fa
55
//JAVA 17
66

77
//Example usage:
@@ -55,6 +55,9 @@ public class ProtectedBranchesScript implements Callable<Integer> {
5555
@Option(names = {"--codeOwnerApprovalRequired" }, description = "codeOwnerApprovalRequired")
5656
private Boolean codeOwnerApprovalRequired;
5757

58+
@Option(names = {"--allowForcedPush" }, description = "allowForcedPush")
59+
private Boolean allowForcedPush;
60+
5861
@Option(names = { "-c", "--config" }, description = "configuration file location")
5962
String configFile;
6063

@@ -94,7 +97,7 @@ public Integer call() {
9497
ensureExists(project, "project");
9598
ensureExists(branch, "branch");
9699
var created = gitLabApi.getProtectedBranchesApi()
97-
.protectBranch(idOrPath(project), branch, pushAccessLevel, mergeAccessLevel, unprotectAccessLevel, codeOwnerApprovalRequired);
100+
.protectBranch(idOrPath(project), branch, pushAccessLevel, mergeAccessLevel, unprotectAccessLevel, codeOwnerApprovalRequired, allowForcedPush);
98101
System.out.println(created);
99102
break;
100103
case DELETE:

0 commit comments

Comments
 (0)