io.github.cdklabs.projen_canary_package.AutoMerge Maven / Gradle / Ivy
package io.github.cdklabs.projen_canary_package;
/**
* Merge pull requests using a merge queue.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-03T15:37:31.238Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen_canary_package.$Module.class, fqn = "@projen/canary-package.AutoMerge")
public class AutoMerge extends io.github.cdklabs.projen.Component {
protected AutoMerge(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected AutoMerge(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param github This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public AutoMerge(final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.github.GitHub github, final @org.jetbrains.annotations.Nullable io.github.cdklabs.projen_canary_package.AutoMergeOptions options) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(github, "github is required"), options });
}
/**
* @param github This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public AutoMerge(final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.github.GitHub github) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(github, "github is required") });
}
/**
* A fluent builder for {@link io.github.cdklabs.projen_canary_package.AutoMerge}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param github This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final io.github.cdklabs.projen.github.GitHub github) {
return new Builder(github);
}
private final io.github.cdklabs.projen.github.GitHub github;
private io.github.cdklabs.projen_canary_package.AutoMergeOptions.Builder options;
private Builder(final io.github.cdklabs.projen.github.GitHub github) {
this.github = github;
}
/**
* Only pull requests authored by these Github usernames will have auto-merge enabled.
*
* Default: - pull requests from all users are eligible for auto-merge
*
* @return {@code this}
* @param allowedUsernames Only pull requests authored by these Github usernames will have auto-merge enabled. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder allowedUsernames(final java.util.List allowedUsernames) {
this.options().allowedUsernames(allowedUsernames);
return this;
}
/**
* Only pull requests with one of this labels will have auto-merge enabled.
*
* Default: - all pull requests are eligible for auto-merge
*
* @return {@code this}
* @param labels Only pull requests with one of this labels will have auto-merge enabled. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder labels(final java.util.List labels) {
this.options().labels(labels);
return this;
}
/**
* The method used to auto-merge the PR.
*
* Any branch protection rules must allow this merge method.
*
* Default: MergeMethod.SQUASH
*
* @return {@code this}
* @param mergeMethod The method used to auto-merge the PR. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder mergeMethod(final io.github.cdklabs.projen_canary_package.MergeMethod mergeMethod) {
this.options().mergeMethod(mergeMethod);
return this;
}
/**
* Github Runner selection labels.
*
* Default: ["ubuntu-latest"]
*
* @return {@code this}
* @param runsOn Github Runner selection labels. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder runsOn(final java.util.List runsOn) {
this.options().runsOn(runsOn);
return this;
}
/**
* A GitHub secret name which contains a GitHub Access Token with write permissions for the pull_request
scope.
*
* This token is used to enable auto-merge on pull requests.
*
* Default: "GITHUB_TOKEN"
*
* @return {@code this}
* @param secret A GitHub secret name which contains a GitHub Access Token with write permissions for the pull_request
scope. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder secret(final java.lang.String secret) {
this.options().secret(secret);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.projen_canary_package.AutoMerge}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public io.github.cdklabs.projen_canary_package.AutoMerge build() {
return new io.github.cdklabs.projen_canary_package.AutoMerge(
this.github,
this.options != null ? this.options.build() : null
);
}
private io.github.cdklabs.projen_canary_package.AutoMergeOptions.Builder options() {
if (this.options == null) {
this.options = new io.github.cdklabs.projen_canary_package.AutoMergeOptions.Builder();
}
return this.options;
}
}
}