Skip to content

Commit bb14a7a

Browse files
committed
chore: add some debugging to requests
1 parent 0536444 commit bb14a7a

2 files changed

Lines changed: 45 additions & 47 deletions

File tree

dist/index.js

Lines changed: 28 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,19 @@ main().catch((error) => {
9292
* @returns {Promise<string>}
9393
*/
9494
async function upload({ apiKey, clientId, file, productId }) {
95-
const res = await fetch(
96-
`${BASE_API_URL}/v1/products/${productId}/submissions/draft/package`,
97-
{
98-
headers: {
99-
Authorization: `ApiKey ${apiKey}`,
100-
'X-ClientID': clientId,
101-
'Content-Type': 'application/zip',
102-
},
103-
// @ts-expect-error
104-
duplex: 'half',
105-
method: 'POST',
106-
body: file,
107-
}
108-
);
95+
const uploadUrl = `${BASE_API_URL}/v1/products/${productId}/submissions/draft/package`;
96+
core.debug(`Making POST request to ${uploadUrl}`);
97+
const res = await fetch(uploadUrl, {
98+
headers: {
99+
Authorization: `ApiKey ${apiKey}`,
100+
'X-ClientID': clientId,
101+
'Content-Type': 'application/zip',
102+
},
103+
// @ts-expect-error
104+
duplex: 'half',
105+
method: 'POST',
106+
body: file,
107+
});
109108

110109
if (res.status !== 202) {
111110
throw new Error(`Got status ${res.status} when uploading add-on`);
@@ -169,10 +168,9 @@ async function publish({ apiKey, clientId, productId, notes }) {
169168
fetchOptions.body = notes;
170169
}
171170

172-
const res = await fetch(
173-
`${BASE_API_URL}/v1/products/${productId}/submissions`,
174-
fetchOptions
175-
);
171+
const publishUrl = `${BASE_API_URL}/v1/products/${productId}/submissions`;
172+
core.debug(`Making POST request to ${publishUrl}`);
173+
const res = await fetch(publishUrl, fetchOptions);
176174

177175
if (res.status !== 202) {
178176
throw new Error(`Got status ${res.status} when uploading add-on`);
@@ -245,6 +243,7 @@ async function waitForOperation({
245243
operation === 'upload'
246244
? `${BASE_API_URL}/v1/products/${productId}/submissions/draft/package/operations/${operationId}`
247245
: `${BASE_API_URL}/v1/products/${productId}/submissions/operations/${operationId}`;
246+
core.debug(`Making GET request to ${operationUrl}`);
248247

249248
let inProgress = true;
250249
while (inProgress) {

0 commit comments

Comments
 (0)