public interface AutoMergeService
| Modifier and Type | Method and Description |
|---|---|
PullRequest |
cancelAutoMerge(int repositoryId,
long pullRequestId,
AutoMergeCancelledReason cancelledReason)
Cancels the automatic merging of the pull request by the system with a provided reason, and logs the cancellation
as a
pull request activity. |
Optional<AutoMergeRequest> |
getAutoMergeRequest(PullRequest pullRequest)
Finds an
auto-merge request for the given pull request. |
boolean |
isSettingEnabledForPullRequest(PullRequest pullRequest) |
PullRequest |
submitAutoMergeRequest(PullRequestMergeRequest pullRequestMergeRequest)
Creates an auto-merge request for the provided pull request with all the parameters from the provided merge
request, if all the following conditions are met:
the
setting is enabled for the repository that the pull request targets
auto-merge is not already requested for this pull request
there are no merge conflicts on the pull request
the pull request cannot be merged immediately
|
AutoMergeProcessingResult |
tryAutoMerge(int repositoryId,
long pullRequestId)
Requests the system to try auto-merging a pull request.
|
@Nonnull PullRequest cancelAutoMerge(int repositoryId, long pullRequestId, @Nonnull AutoMergeCancelledReason cancelledReason)
pull request activity. If a pull request was set to auto-merge,
and it has not been merged yet, invoking this method will ensure that the system does not try to merge this pull
request, and it has to be merged manually. If the pull request is not set to auto-merge this method is a no-op.repositoryId - the ID of the repository to which the pull request is supposed to mergepullRequestId - the ID of the pull request within the repositorycancelledReason - the reason the auto-merge request has been cancelledNoSuchPullRequestException - if the pull request is not foundIllegalPullRequestStateException - if the pull request is currently locked
for some other operation.@Nonnull Optional<AutoMergeRequest> getAutoMergeRequest(@Nonnull PullRequest pullRequest)
auto-merge request for the given pull request.pullRequest - the pull request for which auto-merge request has to be fetchedOptional containing auto-merge request for the pull request, if one exists, otherwise
Optional.empty()boolean isSettingEnabledForPullRequest(@Nonnull PullRequest pullRequest)
pullRequest - the pull request to check if its target repository has auto-merge settings enabledtrue if auto-merge is enabled for the repository containing the pull request; otherwise,
false if it is disabled@Nonnull PullRequest submitAutoMergeRequest(@Nonnull PullRequestMergeRequest pullRequestMergeRequest)
setting is enabled for the repository that the pull request targetscannot be merged immediately
If the auto-merge request is submitted successfully, the system will merge this pull request on behalf of the
user that requested auto-merge once the pull request is ready to merge.
If the pull request is already mergeable, it will be merged immediately.
pullRequestMergeRequest - the parameters to be used to auto-merge the pull request when it is ready to mergeAutoMergeSettingNotEnabledException - if the auto-merge setting is not enabled for this repositoryIllegalPullRequestStateException - if the pull request has merge conflict(s)@Nonnull AutoMergeProcessingResult tryAutoMerge(int repositoryId, long pullRequestId)
source branch or the
auto-merge request has expired, then the request is cancelled.can be merged. If the pull request cannot
be merged, e.g. because it is locked due to rescoping or has conflicts with the target branch, then the request is
cancelled.If both conditions are met, then the merge will be attempted.
repositoryId - the ID of the repository to which the pull request is supposed to mergepullRequestId - the ID of the pull request within the repositoryAutoMergeNotRequestedException - if no auto-merge request is found for the specified pull requestAutoMergeSettingNotEnabledException - if the auto-merge setting is not enabled for this repositoryNoSuchPullRequestException - if the pull request is not foundPullRequestMergeVetoedException - if the pull request was vetoed while merging but not during
dry runCopyright © 2023 Atlassian. All rights reserved.