mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-22 01:53:24 +01:00
0545ad285a
* (feat): Check for existing wrangler installation * Add test for pre-installed wrangler * Add changeset * Address CR comments - check for an exact wrangler version match * Tweak the fixture test for the pre-installed-wrangler test * Simplify if/else logic for checking wrangler versions as per review notes * fix(test): Fix execution for fake wrangler installation * fixup! fix(test): Fix execution for fake wrangler installation * Setup new CI test convention for wrangler-action * Remove unncessary ts-expect-error comments --------- Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
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);
|