Skip to content

Commit

Permalink
wait for completion
Browse files Browse the repository at this point in the history
  • Loading branch information
tpikachu committed Feb 21, 2024
1 parent 9ad1b80 commit 17b686e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
24 changes: 11 additions & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32477,22 +32477,18 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(
"workflow data",
workflow.data.status,
workflow.data.conclusion
);
return workflow.data.status;
};

let checkTimes = 0;
await checkStatus();
const intervalId = setInterval(() => {
checkStatus();
checkTimes++;
if (checkTimes > 10) {
clearInterval(intervalId);
const waitUntilComplete = async () => {
let status = await checkStatus();
while (status !== "completed") {
await waitFor(1000 * 60 * 1);
status = await checkStatus();
}
}, 1000 * 60 * 1);
};

await waitUntilComplete();

// list workflow run artifacts
const artifacts = await octokit.request(
Expand Down Expand Up @@ -32530,6 +32526,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
const oiResult = textDecoder.decode(unzippedData["oiResult.txt"]);

console.log(shareLink, oiResult);

setOutput(shareLink, oiResult);
})();

})();
Expand Down
24 changes: 11 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,18 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(
"workflow data",
workflow.data.status,
workflow.data.conclusion
);
return workflow.data.status;
};

let checkTimes = 0;
await checkStatus();
const intervalId = setInterval(() => {
checkStatus();
checkTimes++;
if (checkTimes > 10) {
clearInterval(intervalId);
const waitUntilComplete = async () => {
let status = await checkStatus();
while (status !== "completed") {
await waitFor(1000 * 60 * 1);
status = await checkStatus();
}
}, 1000 * 60 * 1);
};

await waitUntilComplete();

// list workflow run artifacts
const artifacts = await octokit.request(
Expand Down Expand Up @@ -146,4 +142,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
const oiResult = textDecoder.decode(unzippedData["oiResult.txt"]);

console.log(shareLink, oiResult);

setOutput(shareLink, oiResult);
})();

0 comments on commit 17b686e

Please sign in to comment.