Fix "No commits between" error (#243)

This commit is contained in:
Simon Lecoq
2021-04-19 19:09:51 +02:00
committed by GitHub
parent e3c07aa2c6
commit 00ac3102f9

View File

@@ -320,6 +320,7 @@
}
catch (error) {
console.debug(error)
//Check if pull request has already been created previously
if (/A pull request already exists/.test(error)) {
info(`Pull request from ${committer.head} to ${committer.branch}`, "(already existing)")
const q = `repo:${github.context.repo.owner}/${github.context.repo.repo}+type:pr+state:open+Auto-generated metrics for run #${github.context.runId}+in:title`
@@ -330,6 +331,12 @@
throw new Error(`Found more than one matching prs: ${prs.map(({number}) => `#${number}`).join(", ")}. Cannot proceed.`)
;({number} = prs.shift())
}
//Check if pull request could not been created because there are no diff between head and base
else if (/No commits between/.test(error)) {
info(`Pull request from ${committer.head} to ${committer.branch}`, "(no diff)")
committer.merge = false
number = "(none)"
}
else
throw error
}