mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-21 17:43:23 +01:00
aa5d18dd1e
This reverts commit 2d275a8f2d
.
28 lines
673 B
JavaScript
28 lines
673 B
JavaScript
const { execSync } = require("child_process");
|
|
|
|
function workerHealthCheck(workerName) {
|
|
const url = `https://${workerName}.devprod-testing7928.workers.dev/secret-health-check`;
|
|
|
|
const buffer = execSync(`curl ${url}`);
|
|
|
|
const response = buffer.toString();
|
|
|
|
if (response.includes("OK")) {
|
|
console.log(`Status: Worker is up! Response: ${response}`);
|
|
} else {
|
|
throw new Error(`Worker is down! Response: ${response}`);
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
const args = Array.from(process.argv);
|
|
const workerName = args.pop();
|
|
|
|
if (!workerName) {
|
|
throw new Error(
|
|
"Please provide the worker name as an argument when calling this program.",
|
|
);
|
|
}
|
|
|
|
workerHealthCheck(workerName);
|