@semantic-release/github 11.0.0 → 11.0.1

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.
Files changed (2) hide show
  1. package/lib/success.js +24 -7
  2. package/package.json +6 -6
package/lib/success.js CHANGED
@@ -88,7 +88,7 @@ export default async function success(pluginConfig, context, { Octokit }) {
88
88
  for (const { nodes, pageInfo } of responseAssociatedPRs) {
89
89
  if (nodes.length === 0) continue;
90
90
 
91
- responsePRs.push(...buildIssuesOrPRsFromResponseNode(nodes, "PR"));
91
+ responsePRs.push(...buildIssuesOrPRsFromResponseNode(nodes));
92
92
  if (pageInfo.hasNextPage) {
93
93
  let cursor = pageInfo.endCursor;
94
94
  let hasNextPage = true;
@@ -171,7 +171,7 @@ export default async function success(pluginConfig, context, { Octokit }) {
171
171
  if (!isEmpty(parsedIssues)) {
172
172
  const uniqueParsedIssues = uniqBy(flatten(parsedIssues), "number");
173
173
 
174
- // Get relatedIssues
174
+ // Get relatedIssues (or relatedPRs i.e. Issues/PRs that are closed by an associatedPR)
175
175
  issues = await inChunks(uniqueParsedIssues, 100, async (chunk) => {
176
176
  const { repository } = await octokit.graphql(
177
177
  buildRelatedIssuesQuery(chunk.map((issue) => issue.number)),
@@ -360,6 +360,7 @@ async function inChunks(items, chunkSize, callback) {
360
360
  * Fields common accross PRs and Issue
361
361
  */
362
362
  const baseFields = `
363
+ __typename
363
364
  id
364
365
  title
365
366
  body
@@ -420,8 +421,25 @@ function buildRelatedIssuesQuery(numbers) {
420
421
  repository(owner: $owner, name: $repo) {
421
422
  ${numbers
422
423
  .map((num) => {
423
- return `issue${num}: issue(number: ${num}) {
424
- ${baseFields}
424
+ return `issue${num}: issueOrPullRequest(number: ${num}) {
425
+ ... on Issue {
426
+ ${baseFields}
427
+ }
428
+ ... on PullRequest {
429
+ ${baseFields}
430
+ mergeable
431
+ changedFiles
432
+ mergedAt
433
+ isDraft
434
+ mergedBy {
435
+ login
436
+ avatarUrl
437
+ url
438
+ }
439
+ commits {
440
+ totalCount
441
+ }
442
+ }
425
443
  }`;
426
444
  })
427
445
  .join("")}
@@ -513,10 +531,9 @@ const loadSingleCommitAssociatedPRs = `#graphql
513
531
  /**
514
532
  * Build associatedPRs or RelatedIssues object (into issue-like object with `pull_request` property) from the GraphQL repository response
515
533
  * @param {object} responseNodes
516
- * @param {"ISSUE" | "PR"} type
517
534
  * @returns {object[]}
518
535
  */
519
- function buildIssuesOrPRsFromResponseNode(responseNodes, type = "ISSUE") {
536
+ function buildIssuesOrPRsFromResponseNode(responseNodes) {
520
537
  const resultArray = [];
521
538
  for (const node of responseNodes) {
522
539
  let baseProps = {
@@ -569,7 +586,7 @@ function buildIssuesOrPRsFromResponseNode(responseNodes, type = "ISSUE") {
569
586
 
570
587
  let result = baseProps;
571
588
 
572
- if (type === "PR") {
589
+ if (node.__typename === "PullRequest") {
573
590
  const prProps = {
574
591
  pull_request: true,
575
592
  mergeable: node.mergeable,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semantic-release/github",
3
3
  "description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
4
- "version": "11.0.0",
4
+ "version": "11.0.1",
5
5
  "type": "module",
6
6
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
7
7
  "ava": {
@@ -40,17 +40,17 @@
40
40
  "url-join": "^5.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "ava": "6.1.3",
43
+ "ava": "6.2.0",
44
44
  "c8": "10.1.2",
45
45
  "cpy": "11.1.0",
46
46
  "cz-conventional-changelog": "3.3.0",
47
47
  "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
48
48
  "lockfile-lint": "4.14.0",
49
49
  "ls-engines": "0.9.3",
50
- "npm-run-all2": "6.2.3",
50
+ "npm-run-all2": "7.0.1",
51
51
  "prettier": "3.3.3",
52
- "publint": "0.2.11",
53
- "semantic-release": "24.1.1",
52
+ "publint": "0.2.12",
53
+ "semantic-release": "24.2.0",
54
54
  "sinon": "19.0.2",
55
55
  "tempy": "3.1.0"
56
56
  },
@@ -127,5 +127,5 @@
127
127
  "github>semantic-release/.github:renovate-config"
128
128
  ]
129
129
  },
130
- "packageManager": "npm@10.8.3"
130
+ "packageManager": "npm@10.9.0"
131
131
  }