Fix pr create/update for already up to date branches

This commit is contained in:
Peter Evans 2020-08-19 17:08:59 +09:00
parent 2570a753e0
commit 8bdec9b230
4 changed files with 4309 additions and 929 deletions

View file

@ -185,19 +185,21 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
`HEAD:refs/heads/${inputs.branch}`
])
core.endGroup()
}
// Set the base. It would have been '' if not specified as an input
inputs.base = result.base
// Set the base. It would have been '' if not specified as an input
inputs.base = result.base
if (result.hasDiffWithBase) {
// Create or update the pull request
await githubHelper.createOrUpdatePullRequest(
inputs,
baseRemote.repository,
branchRepository
)
} else {
// If there is no longer a diff with the base delete the branch
if (result.hasDiffWithBase) {
// Create or update the pull request
await githubHelper.createOrUpdatePullRequest(
inputs,
baseRemote.repository,
branchRepository
)
} else {
// If there is no longer a diff with the base delete the branch
if (['updated', 'not-updated'].includes(result.action)) {
core.info(
`Branch '${inputs.branch}' no longer differs from base branch '${inputs.base}'`
)