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 6af2d1f commit 4f2536d
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=${info.branchName}:origin/${info.branchName}` : ''} gk-origin HEAD:${info.branchName}`, {
stdio: [
'pipe',
Expand Down

0 comments on commit 4f2536d

Please sign in to comment.