Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
🐛 Fixed bug trying to get last commit for release clones
Browse files Browse the repository at this point in the history
  • Loading branch information
davidahouse committed Nov 25, 2020
1 parent 1387968 commit 968da5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/workingDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function prepareWorkingDirectory(taskExecutionConfig, conf, logger) {
}

// Perform the checkout
if (gitOperations.sha != null) {
if (gitOperations.shouldCheckout == true && gitOperations.sha != null) {
const checkoutResult = await gitCheckout(gitOperations.sha, dir, logger);
if (checkoutResult === false) {
return {
Expand Down Expand Up @@ -317,6 +317,7 @@ function generateGitOperations(taskExecutionConfig, conf) {
return {
clone: taskExecutionConfig.task.scm.pullRequest.head.ref,
sha: taskExecutionConfig.task.scm.pullRequest.head.sha,
shouldCheckout: true,
depth: parseInt(conf.defaultGitCloneDepth),
merge: conf.gitMerge,
mergeBase: taskExecutionConfig.task.scm.pullRequest.base.ref,
Expand All @@ -326,21 +327,24 @@ function generateGitOperations(taskExecutionConfig, conf) {
return {
clone: taskExecutionConfig.task.scm.branch.name,
sha: null,
shouldCheckout: false,
depth: parseInt(conf.defaultGitCloneDepth),
merge: false,
};
} else {
return {
clone: taskExecutionConfig.task.scm.branch.name,
sha: taskExecutionConfig.task.scm.branch.sha,
shouldCheckout: true,
depth: parseInt(conf.defaultGitCloneDepth),
merge: false,
};
}
} else if (taskExecutionConfig.task.scm.release != null) {
return {
clone: taskExecutionConfig.task.scm.release.tag,
sha: null,
sha: taskExecutionConfig.task.scm.release.sha,
shouldCheckout: false,
depth: parseInt(conf.defaultGitCloneDepth),
merge: false,
};
Expand Down

0 comments on commit 968da5e

Please sign in to comment.