Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,15 @@ private static PullRequestInfo buildUserPullRequestInfo(
String targetSha = environment.get(Constants.DDCI_PULL_REQUEST_TARGET_SHA);
String sourceSha = environment.get(Constants.DDCI_PULL_REQUEST_SOURCE_SHA);
String mergeBase = null;
try {
mergeBase = gitClient.getMergeBase(targetSha, sourceSha);
} catch (Exception ignored) {

if (!Constants.DDCI_LEGACY_KIND.equals(environment.get(Constants.DDCI_REQUEST_KIND))) {
// legacy mode doesn't set a valid target sha to compute the merge base
try {
mergeBase = gitClient.getMergeBase(targetSha, sourceSha);
} catch (Exception ignored) {
}
}

PullRequestInfo ddCiInfo =
new PullRequestInfo(
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ public interface Constants {
* the necessary data is not exposed by the CI provider
*/
String DDCI_PULL_REQUEST_TARGET_SHA = "DDCI_PULL_REQUEST_TARGET_SHA";

/**
* Env var containing the DDCI mode used. When the legacy mode is used,
* DDCI_PULL_REQUEST_TARGET_SHA won't contain the expected value, but the previous base on the
* push event.
*/
String DDCI_REQUEST_KIND = "DDCI_REQUEST_KIND";

// Legacy mode identifier
String DDCI_LEGACY_KIND = "REQUEST_KIND_LEGACY_REQUEST";
}