Imported from zentered/cloudflare-preview-url (
AGENTS.md). Install upstream withnpx skills add zentered/cloudflare-preview-url. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
src/: Action source (ESM). Entry issrc/index.js, callscloudflare.jsandcloudflare-statuscheck.js.dist/: Compiled bundle fromncc. Do not edit files here.test/: Node test files (*.test.js) and JSON fixtures intest/fixtures/.- Root:
action.yml(inputs/outputs), configs (eslint.config.js,.prettierrc), CI, and docs.
Build, Test, and Development Commands
npm run lint— Lints all files with ESLint.npm test— Runs Node’snode:testsuite.npm run prepare— Bundles todist/via@vercel/nccwith source maps.npm run build—lint+test+prepare(use before publishing).- First-time setup:
npm i(installs Husky hooks). Node>=20is required.
Coding Style & Naming Conventions
- Formatting via Prettier: single quotes, no semicolons, no trailing commas.
- ESLint:
@eslint/jsrecommended rules; Node globals enabled;dist/ignored. - Files: kebab-case for filenames (
cloudflare-statuscheck.js), camelCase for functions/vars. - Keep modules small and focused; prefer pure functions and explicit inputs.
Testing Guidelines
- Framework: built-in
node:test; mocking viaesmock. - Place fixtures in
test/fixtures/*.jsonand import withreadFileSyncas in existing tests. - Name tests
*.test.jsand colocate undertest/. - Run locally with
npm test; add tests for new inputs, filtering, and failure paths.
Commit & Pull Request Guidelines
- Conventional Commits enforced by Commitlint/Husky (e.g.,
feat: add wait flag,fix: handle empty result). - Pre-commit runs lint-staged (Prettier + ESLint). Ensure
npm testpasses. - PRs should include: clear description, linked issues, rationale, and test
updates. If
action.ymlor outputs change, updateREADME.mdexamples.
Security & Configuration Tips
- Required secrets:
CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID; optionalCLOUDFLARE_ACCOUNT_EMAIL. - Never log tokens or emails. Prefer dependency injection and mocks in tests; avoid live API calls.
- Do not commit changes to
dist/without runningnpm run build.
