From 7282b07d74341620c1d41ed2c0af092a48285564 Mon Sep 17 00:00:00 2001 From: peter-evans Date: Sun, 6 Sep 2020 01:33:31 +0000 Subject: [PATCH] [CI] test built --- action.yml | 5 +++++ dist/index.js | 20 ++++++++++++-------- report.txt | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 report.txt diff --git a/action.yml b/action.yml index c306a7b..c169c32 100644 --- a/action.yml +++ b/action.yml @@ -27,6 +27,11 @@ inputs: branch: description: 'The pull request branch name.' default: 'create-pull-request/patch' + delete-branch: + description: > + Delete the `branch` when closing pull requests, and when undeleted after merging. + Recommend `true`. + default: false branch-suffix: description: 'The branch suffix type when using the alternative branching strategy.' base: diff --git a/dist/index.js b/dist/index.js index 1b848f2..e8e1ee0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1405,6 +1405,7 @@ function run() { author: core.getInput('author'), signoff: core.getInput('signoff') === 'true', branch: core.getInput('branch'), + deleteBranch: core.getInput('delete-branch') === 'true', branchSuffix: core.getInput('branch-suffix'), base: core.getInput('base'), pushToFork: core.getInput('push-to-fork'), @@ -7035,16 +7036,19 @@ function createPullRequest(inputs) { yield githubHelper.createOrUpdatePullRequest(inputs, baseRemote.repository, branchRepository); } else { - // If there is no longer a diff with the base delete the branch + // There is no longer a diff with the base + // Check we are in a state where a branch exists if (['updated', 'not-updated'].includes(result.action)) { core.info(`Branch '${inputs.branch}' no longer differs from base branch '${inputs.base}'`); - core.info(`Closing pull request and deleting branch '${inputs.branch}'`); - yield git.push([ - '--delete', - '--force', - branchRemoteName, - `refs/heads/${inputs.branch}` - ]); + if (inputs.deleteBranch) { + core.info(`Deleting branch '${inputs.branch}'`); + yield git.push([ + '--delete', + '--force', + branchRemoteName, + `refs/heads/${inputs.branch}` + ]); + } } } } diff --git a/report.txt b/report.txt new file mode 100644 index 0000000..6a6ce57 --- /dev/null +++ b/report.txt @@ -0,0 +1 @@ +1599356011