@jsenv/github-pull-request-impact 1.6.7 → 1.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,4 +10,4 @@ This repository publishes `@jsenv/github-pull-request-impact` on NPM. This packa
10
10
 
11
11
  - [@jsenv/performance-impact](../jsenv-performance-impact)
12
12
  - [@jsenv/file-size-impact](../jsenv-file-size-impact)
13
- - [@jsenv/lighthouse-score-impact](../jsenv-performance-impact)
13
+ - [@jsenv/lighthouse-impact](../jsenv-lighthouse-impact)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/github-pull-request-impact",
3
- "version": "1.6.7",
3
+ "version": "1.6.10",
4
4
  "description": "Report pull request impact on something",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,7 @@ export const commentGitHubPullRequestImpact = async ({
33
33
  createCommentForVersionMismatch = jsenvCreateCommentForVersionMismatch,
34
34
  createCommentForComparison = jsenvCreateCommentForComparison,
35
35
  generatedByLink = {
36
- url: "https://github.com/jsenv/github-pull-request-impact",
36
+ url: "https://github.com/jsenv/workflow/tree/main/packages/jsenv-github-pull-request-impact",
37
37
  text: "@jsenv/github-pull-request-impact",
38
38
  },
39
39
  runLink,
@@ -177,7 +177,7 @@ const commentPrImpact = async ({
177
177
 
178
178
  logger.debug(`searching comment in pull request ${pullRequestHtmlUrl}`)
179
179
  const pullRequestCommentApiUrl = pullRequest.comments_url
180
- const comments = await pullApiUrl.GET({
180
+ const comments = await githubRESTAPI.GET({
181
181
  url: pullRequestCommentApiUrl,
182
182
  githubToken,
183
183
  })
@@ -305,9 +305,14 @@ const commentPrImpact = async ({
305
305
  valueIfMissing: "Your Name",
306
306
  execCommandInProjectDirectory,
307
307
  })
308
- await execCommandInProjectDirectory(
309
- `git merge FETCH_HEAD --allow-unrelated-histories`,
310
- )
308
+ // could we use https://stackoverflow.com/a/6283843 ?
309
+ try {
310
+ await execCommandInProjectDirectory(
311
+ `git merge FETCH_HEAD --allow-unrelated-histories --no-ff --no-commit`,
312
+ )
313
+ } catch (e) {
314
+ throw new Error(`git merge command failed (is there a merge conflict?)`)
315
+ }
311
316
  await restoreGitUserEmail()
312
317
  await restoreGitUserName()
313
318
  afterMergeInfo = await collectInfo({
@@ -11,11 +11,11 @@ export const exec = (
11
11
  cwd,
12
12
  stdio: "silent",
13
13
  },
14
- (error) => {
14
+ (error, out) => {
15
15
  if (error) {
16
16
  reject(error)
17
17
  } else {
18
- resolve()
18
+ resolve(out)
19
19
  }
20
20
  },
21
21
  )
@@ -54,16 +54,12 @@ export const PATCH = async ({ url, body, githubToken, headers }) => {
54
54
  })
55
55
  }
56
56
 
57
- export const tokenAsAuthorizationHeaderValue = (token) => {
58
- return `token ${Buffer.from(token).toString("base64")}`
59
- }
60
-
61
57
  const tokenToHeaders = (token) => {
62
58
  if (!token) {
63
59
  throw new Error(`missing token, request will not be authorized.`)
64
60
  }
65
61
  return {
66
- authorization: tokenAsAuthorizationHeaderValue(token),
62
+ authorization: `token ${token}`,
67
63
  }
68
64
  }
69
65