Skip to content

Commit

Permalink
fix(upload): rearrange hasLockFileCommit
Browse files Browse the repository at this point in the history
hasLockFileCommit needs to be calles after gk-origin remote url is configured.
  • Loading branch information
hulkoba committed Jul 16, 2018
1 parent 53305bd commit 944629a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ module.exports = function upload () {
return console.error('Only uploading on one build job')
}

if (hasLockfileCommit(info)) {
return console.error('greenkeeper-lockfile already has a commit on this branch')
}

let remote = `[email protected]:${info.repoSlug}`
if (info.gitUrl) remote = info.gitUrl

Expand All @@ -51,9 +47,13 @@ module.exports = function upload () {
remote = url.format(urlParsed)
}

const err = fs.openSync('gk-lockfile-git-push.err', 'w')

exec(`git remote add gk-origin ${remote} || git remote set-url gk-origin ${remote}`)

if (hasLockfileCommit(info)) {
return console.error('greenkeeper-lockfile already has a commit on this branch')
}

const err = fs.openSync('gk-lockfile-git-push.err', 'w')
exec(`git push${process.env.GK_LOCK_COMMIT_AMEND ? ' --force-with-lease' : ''} gk-origin HEAD:${info.branchName}`, {
stdio: [
'pipe',
Expand Down

0 comments on commit 944629a

Please sign in to comment.