Skip to content

Commit

Permalink
Add --allowForcedPush to ProtectedBranchesScript
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini committed Dec 26, 2023
1 parent 7fdb450 commit 8adfe8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gitlab4j-test/ProtectedBranchesScript.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///usr/bin/env jbang "$0" "$@" ; exit $?

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

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

@Option(names = {"--allowForcedPush" }, description = "allowForcedPush")
private Boolean allowForcedPush;

@Option(names = { "-c", "--config" }, description = "configuration file location")
String configFile;

Expand Down Expand Up @@ -94,7 +97,7 @@ public Integer call() {
ensureExists(project, "project");
ensureExists(branch, "branch");
var created = gitLabApi.getProtectedBranchesApi()
.protectBranch(idOrPath(project), branch, pushAccessLevel, mergeAccessLevel, unprotectAccessLevel, codeOwnerApprovalRequired);
.protectBranch(idOrPath(project), branch, pushAccessLevel, mergeAccessLevel, unprotectAccessLevel, codeOwnerApprovalRequired, allowForcedPush);
System.out.println(created);
break;
case DELETE:
Expand Down

0 comments on commit 8adfe8f

Please sign in to comment.