1 diff --git a/dist/get-github-info.cjs.dev.js b/dist/get-github-info.cjs.dev.js
2 index 4f70e5c2113328562d998f7234d41fa5b40059e2..56a71544cfd76104a7d69b72bd268eed6f29e8f6 100644
3 --- a/dist/get-github-info.cjs.dev.js
4 +++ b/dist/get-github-info.cjs.dev.js
5 @@ -169,13 +169,19 @@ const GHDataLoader = new DataLoader__default['default'](async requests => {
6
7 repos[repo].push(data);
8 });
9 + // I need to temporarily reduce the amount of commits we're fetching from GitHub to avoid errors from GitHub graphql API
10 + const medusaCommits = repos["medusajs/medusa"];
11 + const reducedCommits = medusaCommits.slice(0, 100) // 100 is an arbitrary number, we just need enough to have some commits with changesets
12 + const reducedRepos = {
13 + "medusajs/medusa": reducedCommits,
14 + };
15 const data = await fetch__default['default']("https://api.github.com/graphql", {
16 method: "POST",
17 headers: {
18 Authorization: `Token ${process.env.GITHUB_TOKEN}`
19 },
20 body: JSON.stringify({
21 - query: makeQuery(repos)
22 + query: makeQuery(reducedRepos)
23 })
24 }).then(x => x.json());
25
26 @@ -232,11 +238,11 @@ async function getInfo(request) {
27 }, request));
28 let user = null;
29
30 - if (data.author && data.author.user) {
31 + if (data && data.author && data.author.user) {
32 user = data.author.user;
33 }
34
35 - let associatedPullRequest = data.associatedPullRequests && data.associatedPullRequests.nodes && data.associatedPullRequests.nodes.length ? data.associatedPullRequests.nodes.sort((a, b) => {
36 + let associatedPullRequest = data && data.associatedPullRequests && data.associatedPullRequests.nodes && data.associatedPullRequests.nodes.length ? data.associatedPullRequests.nodes.sort((a, b) => {
37 if (a.mergedAt === null && b.mergedAt === null) {
38 return 0;
39 }
40 @@ -262,7 +268,7 @@ async function getInfo(request) {
41 user: user ? user.login : null,
42 pull: associatedPullRequest ? associatedPullRequest.number : null,
43 links: {
44 - commit: `[\`${request.commit}\`](${data.commitUrl})`,
45 + commit: `[\`${request.commit}\`](${data && data.commitUrl})`,
46 pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
47 user: user ? `[@${user.login}](${user.url})` : null
48 }
49 diff --git a/dist/get-github-info.cjs.prod.js b/dist/get-github-info.cjs.prod.js
50 index 879e55a7de71b291b021c6d0162e1577ab482a5d..8f89225d611a706a8336437cccb21861463e1583 100644
51 --- a/dist/get-github-info.cjs.prod.js
52 +++ b/dist/get-github-info.cjs.prod.js
53 @@ -76,13 +76,19 @@ const GHDataLoader = new DataLoader__default.default((async requests => {
54 let {repo: repo} = _ref, data = _objectWithoutProperties(_ref, _excluded);
55 void 0 === repos[repo] && (repos[repo] = []), repos[repo].push(data);
56 }));
57 + // I need to temporarily reduce the amount of commits we're fetching from GitHub to avoid errors from GitHub graphql API
58 + const medusaCommits = repos["medusajs/medusa"];
59 + const reducedCommits = medusaCommits.slice(0, 100) // 100 is an arbitrary number, we just need enough to have some commits with changesets
60 + const reducedRepos = {
61 + "medusajs/medusa": reducedCommits,
62 + };
63 const data = await fetch__default.default("https://api.github.com/graphql", {
64 method: "POST",
65 headers: {
66 Authorization: "Token " + process.env.GITHUB_TOKEN
67 },
68 body: JSON.stringify({
69 - query: makeQuery(repos)
70 + query: makeQuery(reducedRepos)
71 })
72 }).then((x => x.json()));
73 if (data.errors) throw new Error("An error occurred when fetching data from GitHub\n" + JSON.stringify(data.errors, null, 2));
74 diff --git a/dist/get-github-info.esm.js b/dist/get-github-info.esm.js
75 index 8978595dac32b007165ba8f87b749c8733ab123f..44a98818ffaced048f4fc75a771c7b52aa6eb9fe 100644
76 --- a/dist/get-github-info.esm.js
77 +++ b/dist/get-github-info.esm.js
78 @@ -160,13 +160,19 @@ const GHDataLoader = new DataLoader(async requests => {
79
80 repos[repo].push(data);
81 });
82 + // I need to temporarily reduce the amount of commits we're fetching from GitHub to avoid errors from GitHub graphql API
83 + const medusaCommits = repos["medusajs/medusa"];
84 + const reducedCommits = medusaCommits.slice(0, 100) // 100 is an arbitrary number, we just need enough to have some commits with changesets
85 + const reducedRepos = {
86 + "medusajs/medusa": reducedCommits,
87 + };
88 const data = await fetch("https://api.github.com/graphql", {
89 method: "POST",
90 headers: {
91 Authorization: `Token ${process.env.GITHUB_TOKEN}`
92 },
93 body: JSON.stringify({
94 - query: makeQuery(repos)
95 + query: makeQuery(reducedRepos)
96 })
97 }).then(x => x.json());
98
99 @@ -223,11 +229,11 @@ async function getInfo(request) {
100 }, request));
101 let user = null;
102
103 - if (data.author && data.author.user) {
104 + if (data && data.author && data.author.user) {
105 user = data.author.user;
106 }
107
108 - let associatedPullRequest = data.associatedPullRequests && data.associatedPullRequests.nodes && data.associatedPullRequests.nodes.length ? data.associatedPullRequests.nodes.sort((a, b) => {
109 + let associatedPullRequest = data && data.associatedPullRequests && data.associatedPullRequests.nodes && data.associatedPullRequests.nodes.length ? data.associatedPullRequests.nodes.sort((a, b) => {
110 if (a.mergedAt === null && b.mergedAt === null) {
111 return 0;
112 }
113 @@ -253,7 +259,7 @@ async function getInfo(request) {
114 user: user ? user.login : null,
115 pull: associatedPullRequest ? associatedPullRequest.number : null,
116 links: {
117 - commit: `[\`${request.commit}\`](${data.commitUrl})`,
118 + commit: `[\`${request.commit}\`](${data && data.commitUrl})`,
119 pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
120 user: user ? `[@${user.login}](${user.url})` : null
121 }
122 diff --git a/src/index.ts b/src/index.ts
123 index 2378f369c4ca5f66b5c9f615e97d5ad143f37f46..ddd5788f4d5edfccef1cda582e12c10bad57b467 100644
124 --- a/src/index.ts
125 +++ b/src/index.ts
126 @@ -1,6 +1,6 @@
127 // @ts-ignore
128 -import fetch from "node-fetch";
129 import DataLoader from "dataloader";
130 +import fetch from "node-fetch";
131
132 const validRepoNameRegex = /^[\w.-]+\/[\w.-]+$/;
133
134 @@ -92,12 +92,19 @@ const GHDataLoader = new DataLoader(async (requests: RequestData[]) => {
135 repos[repo].push(data);
136 });
137
138 + // I need to temporarily reduce the amount of commits we're fetching from GitHub to avoid errors from GitHub graphql API
139 + const medusaCommits = repos["medusajs/medusa"];
140 + const reducedCommits = medusaCommits.slice(0, 100) // 100 is an arbitrary number, we just need enough to have some commits with changesets
141 + const reducedRepos = {
142 + "medusajs/medusa": reducedCommits,
143 + };
144 +
145 const data = await fetch("https://api.github.com/graphql", {
146 method: "POST",
147 headers: {
148 Authorization: `Token ${process.env.GITHUB_TOKEN}`,
149 },
150 - body: JSON.stringify({ query: makeQuery(repos) }),
151 + body: JSON.stringify({ query: makeQuery(reducedRepos) }),
152 }).then((x: any) => x.json());
153
154 if (data.errors) {