From 6440ffc708e6cefdd4fea3f656138efef41aad99 Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Wed, 31 Jul 2024 16:03:13 +1200 Subject: [PATCH] fix(ci): add more logging --- index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 098e1af..edc49ad 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,9 @@ async function updateBadge(body) { ["x-api-key", `${core.getInput("auth")}`], ]); - let response = await fetch(hostUrl, { + console.log("Making post request to: %s", hostUrl); + + const response = await fetch(hostUrl, { method: "POST", headers, body, @@ -33,15 +35,15 @@ async function updateBadge(body) { if (!response.ok) { console.log("Returned: %j", response.body); - console.log(`Fetching badge failed: ${console.log(util.inspect(response, false, null, true /* enable colors */))}`); if (response.status === 409) { // This means likely the badge already exists. Try to patch - response = await fetch(hostUrl, { + console.log("Running patch on %s", hostUrl); + response2 = await fetch(hostUrl, { method: 'PATCH', headers, body, }); - if (!response.ok) { + if (!response2.ok) { core.setFailed( `Failed to create gist, response status code: ${response.status} ${response.statusText}` );