fix(ci): add more logging
Some checks failed
Build Badges / Create Answer Badge (push) Failing after 2s
Build Badges / Create Color Range Badges (0) (push) Failing after 2s
Build Badges / Create Color Range Badges (10) (push) Failing after 2s
Build Badges / Create Color Range Badges (100) (push) Failing after 2s
Build Badges / Create Color Range Badges (20) (push) Failing after 2s
Build Badges / Create Color Range Badges (30) (push) Failing after 2s
Build Badges / Create Color Range Badges (40) (push) Failing after 2s
Build Badges / Create Color Range Badges (50) (push) Failing after 2s
Build Badges / Create Color Range Badges (60) (push) Failing after 2s
Build Badges / Create Color Range Badges (70) (push) Failing after 2s
Build Badges / Create Color Range Badges (80) (push) Failing after 2s
Build Badges / Create Color Range Badges (90) (push) Failing after 2s
Checks / Check REUSE (push) Successful in 6s

This commit is contained in:
2024-07-31 16:03:13 +12:00
parent 001178768a
commit 6440ffc708

View File

@@ -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}`
);