@semantic-release/github 11.0.0 → 11.0.2

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 (3) hide show
  1. package/README.md +6 -2
  2. package/lib/success.js +24 -7
  3. package/package.json +11 -11
package/README.md CHANGED
@@ -19,6 +19,10 @@
19
19
 
20
20
  ## Install
21
21
 
22
+ > [!TIP]
23
+ > You do not need to directly depend on this package if you are using `semantic-release`.
24
+ > `semantic-release` already depends on this package, and defining your own direct dependency can result in conflicts when you update `semantic-release`.
25
+
22
26
  ```bash
23
27
  $ npm install @semantic-release/github -D
24
28
  ```
@@ -185,7 +189,7 @@ The `successComment` `This ${issue.pull_request ? 'pull request' : 'issue'} is i
185
189
 
186
190
  #### successCommentCondition
187
191
 
188
- The message for the issue comments is generated with [Lodash template](https://lodash.com/docs#template). The following variables are available:
192
+ A [Lodash template](https://lodash.com/docs#template) string that should evaluate to a truthy or falsy variable. The following variables are available:
189
193
 
190
194
  | Parameter | Description |
191
195
  | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -226,7 +230,7 @@ The `failComment` `This release from branch ${branch.name} had failed due to the
226
230
 
227
231
  #### failCommentCondition
228
232
 
229
- The message for the issue content is generated with [Lodash template](https://lodash.com/docs#template). The following variables are available:
233
+ A [Lodash template](https://lodash.com/docs#template) string that should evaluate to a truthy or falsy variable. The following variables are available:
230
234
 
231
235
  | Parameter | Description |
232
236
  | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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.2",
5
5
  "type": "module",
6
6
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
7
7
  "ava": {
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@octokit/core": "^6.0.0",
26
- "@octokit/plugin-paginate-rest": "^11.0.0",
26
+ "@octokit/plugin-paginate-rest": "^12.0.0",
27
27
  "@octokit/plugin-retry": "^7.0.0",
28
- "@octokit/plugin-throttling": "^9.0.0",
28
+ "@octokit/plugin-throttling": "^10.0.0",
29
29
  "@semantic-release/error": "^4.0.0",
30
30
  "aggregate-error": "^5.0.0",
31
31
  "debug": "^4.3.4",
@@ -40,18 +40,18 @@
40
40
  "url-join": "^5.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "ava": "6.1.3",
44
- "c8": "10.1.2",
43
+ "ava": "6.2.0",
44
+ "c8": "10.1.3",
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",
51
- "prettier": "3.3.3",
52
- "publint": "0.2.11",
53
- "semantic-release": "24.1.1",
54
- "sinon": "19.0.2",
50
+ "npm-run-all2": "7.0.2",
51
+ "prettier": "3.5.3",
52
+ "publint": "0.3.12",
53
+ "semantic-release": "24.2.3",
54
+ "sinon": "20.0.0",
55
55
  "tempy": "3.1.0"
56
56
  },
57
57
  "engines": {
@@ -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@11.3.0"
131
131
  }