Socket
Socket
Sign inDemoInstall

@semantic-release/github

Package Overview
Dependencies
Maintainers
4
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-release/github - npm Package Compare versions

Comparing version 10.1.5 to 10.1.6

77

lib/success.js

@@ -70,10 +70,41 @@ import { isNil, uniqBy, template, flatten, isEmpty } from "lodash-es";

const { repository } = await octokit.graphql(
buildAssociatedPRsQuery(shas),
{ owner, repo },
);
const associatedPRs = Object.values(repository).map(
(item) => item.associatedPullRequests.nodes,
);
const associatedPRs = [];
// Split commit shas into chunks of 100 shas
const chunkSize = 100;
const shasChunks = [];
for (let i = 0; i < shas.length; i += chunkSize) {
const chunk = shas.slice(i, i + chunkSize);
shasChunks.push(chunk);
}
for (const chunk of shasChunks) {
const { repository } = await octokit.graphql(
buildAssociatedPRsQuery(chunk),
{ owner, repo },
);
const responseAssociatedPRs = Object.values(repository).map(
(item) => item.associatedPullRequests,
);
for (const { nodes, pageInfo } of responseAssociatedPRs) {
associatedPRs.push(nodes);
if (pageInfo.hasNextPage) {
let cursor = pageInfo.endCursor;
let hasNextPage = true;
while (hasNextPage) {
const { repository } = await octokit.graphql(
loadSingleCommitAssociatedPRs,
{ owner, repo, sha: response.commit.oid, cursor },
);
const { associatedPullRequests } = repository.commit;
associatedPRs.push(associatedPullRequests.nodes);
if (associatedPullRequests.pageInfo.hasNextPage) {
cursor = associatedPullRequests.pageInfo.endCursor;
} else {
hasNextPage = false;
}
}
}
}
}
const uniqueAssociatedPRs = uniqBy(flatten(associatedPRs), "number");

@@ -256,3 +287,3 @@

*/
export function buildAssociatedPRsQuery(shas) {
function buildAssociatedPRsQuery(shas) {
return `#graphql

@@ -265,3 +296,8 @@ query getAssociatedPRs($owner: String!, $repo: String!) {

...on Commit {
oid
associatedPullRequests(first: 100) {
pageInfo {
endCursor
hasNextPage
}
nodes {

@@ -281,1 +317,26 @@ url

}
/**
* GraphQL Query to fetch additional associatedPR for commits that has more than 100 associatedPRs
*/
const loadSingleCommitAssociatedPRs = `#graphql
query getCommitAssociatedPRs($owner: String!, $repo: String!, $sha: String!, $cursor: String) {
repository(owner: $owner, name: $repo) {
commit: object(oid: $sha) {
...on Commit {
associatedPullRequests(after: $cursor, first: 100) {
pageInfo {
endCursor
hasNextPage
}
nodes {
url
number
body
}
}
}
}
}
}
`;

4

package.json
{
"name": "@semantic-release/github",
"description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
"version": "10.1.5",
"version": "10.1.6",
"type": "module",

@@ -52,3 +52,3 @@ "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",

"prettier": "3.3.3",
"publint": "0.2.9",
"publint": "0.2.10",
"semantic-release": "24.0.0",

@@ -55,0 +55,0 @@ "sinon": "18.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc