From 1b7b79dcb333c32ddba195d6a410a4a5e2612096 Mon Sep 17 00:00:00 2001 From: peter-evans Date: Sat, 5 Sep 2020 09:49:01 +0000 Subject: [PATCH] [CI] test committed --- dist/index.js | 13 ++++++++++--- report.txt | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 report.txt diff --git a/dist/index.js b/dist/index.js index 1b848f2..b016971 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3080,9 +3080,16 @@ 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. This means there will be + // no pull request diff after the branch is reset. 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 due to different commits for the + // same changes. + // 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))) { 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..e820760 --- /dev/null +++ b/report.txt @@ -0,0 +1 @@ +1599299340