From a15b594fb80fb73be253a3022476a069d1a5be7c Mon Sep 17 00:00:00 2001 From: peter-evans Date: Sat, 5 Sep 2020 08:18:58 +0000 Subject: [PATCH] [CI] test committed --- dist/index.js | 14 +++++++++++--- report.txt | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 report.txt diff --git a/dist/index.js b/dist/index.js index 1b848f2..becb437 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3080,9 +3080,17 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName core.info(`Pull request branch '${branch}' already exists as remote branch '${branchRemoteName}/${branch}'`); // Checkout the pull request branch yield git.checkout(branch); - if (yield hasDiff(git, branch, tempBranch)) { - // If the branch differs from the recreated temp version then the branch is reset - // For changes on base this action is similar to a rebase of the pull request branch + // Reset the branch if one of the following conditions is true. + // - If the branch differs from the recreated temp branch. + // - If the recreated temp branch is not ahead of the base AND the branch is both + // ahead AND behind the base. This catches a case where the branch was squash + // merged but not deleted. We need to reset to make sure it doesn't appear to + // have a diff with the base. + // For changes on base this reset is equivalent to a rebase of the pull request branch. + if ((yield hasDiff(git, branch, tempBranch)) || + (!(yield isAhead(git, base, tempBranch)) && + (yield isAhead(git, base, branch)) && + (yield isBehind(git, base, branch)))) { core.info(`Resetting '${branch}'`); // Alternatively, git switch -C branch tempBranch yield git.checkout(branch, tempBranch); diff --git a/report.txt b/report.txt new file mode 100644 index 0000000..81eb48a --- /dev/null +++ b/report.txt @@ -0,0 +1 @@ +1599293938