Skip to content

Commit

Permalink
Fix github push during bump (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: Bumpr <[email protected]>
  • Loading branch information
job13er and Bumpr authored Dec 20, 2022
1 parent a52585c commit 83d80b2
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 103 deletions.
28 changes: 14 additions & 14 deletions src/vcs/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function convertPr(ghPr) {
description: convertLineEndings(ghPr.body),
name: ghPr.title,
number: ghPr.number,
url: ghPr.html_url
url: ghPr.html_url,
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ class GitHub {

// TODO: find a safer way to do this, as the token can be displayed if a bug
// is introduced here and exec errors out.
return exec(`git remote add ci-origin https://${ghToken}@github.com/${owner}/${name}`).then(() => 'ci-origin')
return exec(`git remote add ci-origin https://bumpr:${ghToken}@github.com/${owner}/${name}`).then(() => 'ci-origin')
}

/**
Expand All @@ -130,14 +130,14 @@ class GitHub {
body: JSON.stringify({
body: description,
name: releaseName,
tag_name: tagName
tag_name: tagName,
}),
headers: {
Authorization: `token ${ghToken}`,
'Content-Type': 'application/json'
}
'Content-Type': 'application/json',
},
})
.then(resp => resp.json().then(json => ({resp, json})))
.then((resp) => resp.json().then((json) => ({resp, json})))
.then(({resp, json}) => {
if (!resp.ok) {
throw new Error(`${resp.status}: ${JSON.stringify(json)}`)
Expand All @@ -159,14 +159,14 @@ class GitHub {
Logger.log(`About to send GET to ${url}`)

return fetch(url, getFetchOpts(this.config))
.then(resp => resp.json().then(json => ({resp, json})))
.then((resp) => resp.json().then((json) => ({resp, json})))
.then(({resp, json}) => {
if (!resp.ok) {
throw new Error(`${resp.status}: ${JSON.stringify(json)}`)
}
return json
})
.then(prs => prs.find(pr => pr.merge_commit_sha === sha))
.then((prs) => prs.find((pr) => pr.merge_commit_sha === sha))
.then(convertPr)
.catch(() => {
throw new Error(`Unable to find a merged PR for sha ${sha}`)
Expand All @@ -185,7 +185,7 @@ class GitHub {
Logger.log(`About to send GET to ${url}`)

return fetch(url, getFetchOpts(this.config))
.then(resp => resp.json().then(json => ({resp, json})))
.then((resp) => resp.json().then((json) => ({resp, json})))
.then(({resp, json}) => {
if (!resp.ok) {
throw new Error(`${resp.status}: ${JSON.stringify(json)}`)
Expand All @@ -209,9 +209,9 @@ class GitHub {
return fetch(url, {
method: 'POST',
body: JSON.stringify({body: comment}),
headers: {'Content-Type': 'application/json'}
headers: {'Content-Type': 'application/json'},
})
.then(resp => resp.json().then(json => ({resp, json})))
.then((resp) => resp.json().then((json) => ({resp, json})))
.then(({resp, json}) => {
if (!resp.ok) {
throw new Error(`${resp.status}: ${JSON.stringify(json)}`)
Expand All @@ -237,10 +237,10 @@ class GitHub {
headers: {
Authorization: `token ${ghToken}`,
'Content-Type': type,
'Content-Length': size
}
'Content-Length': size,
},
})
.then(resp => resp.json().then(json => ({resp, json})))
.then((resp) => resp.json().then((json) => ({resp, json})))
.then(({resp, json}) => {
if (!resp.ok) {
throw new Error(`${resp.status}: ${JSON.stringify(json)}`)
Expand Down
Loading

0 comments on commit 83d80b2

Please sign in to comment.