Skip to content
Snippets Groups Projects
Commit a6ca9ce1 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

ensurePr

parent 4e2e5390
No related branches found
No related tags found
No related merge requests found
...@@ -92,14 +92,14 @@ function updateDependency(depType, depName, currentVersion, nextVersion) { ...@@ -92,14 +92,14 @@ function updateDependency(depType, depName, currentVersion, nextVersion) {
const newPackageContents = JSON.stringify(currentFileContent, null, 2) + '\n'; const newPackageContents = JSON.stringify(currentFileContent, null, 2) + '\n';
return github.writeFile(branchName, currentSHA, packageFile, newPackageContents, commitMessage) return github.writeFile(branchName, currentSHA, packageFile, newPackageContents, commitMessage)
.then(() => { .then(() => {
return createOrUpdatePullRequest(branchName, prTitle, prBody); return ensurePr(branchName, prTitle, prBody);
}); });
} else { } else {
if (config.verbose) { if (config.verbose) {
console.log(`${depName} was already up-to-date in branch ${branchName}`); console.log(`${depName} was already up-to-date in branch ${branchName}`);
} }
// File was up to date. Ensure PR // File was up to date. Ensure PR
return createOrUpdatePullRequest(branchName, prTitle, prBody); return ensurePr(branchName, prTitle, prBody);
} }
}); });
}) })
...@@ -109,7 +109,7 @@ function updateDependency(depType, depName, currentVersion, nextVersion) { ...@@ -109,7 +109,7 @@ function updateDependency(depType, depName, currentVersion, nextVersion) {
}); });
} }
function createOrUpdatePullRequest(branchName, prTitle, prBody) { function ensurePr(branchName, prTitle, prBody) {
return github.getPr(branchName).then(pr => { return github.getPr(branchName).then(pr => {
if (pr) { if (pr) {
if (pr.title === prTitle && pr.body === prBody) { if (pr.title === prTitle && pr.body === prBody) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment