Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upload): rearrange hasLockFileCommit #183

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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