This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run buildCompiles src/action.js into dist/index.js using @vercel/ncc. The dist file must be committed for the GitHub Action to work.
npm installCurrently no tests are implemented. The test script exits with error.
This is a GitHub Action for WordPress testing automation that integrates with InstaWP's API. The entire action logic lives in a single file: src/action.js.
-
Action Entry Point (
src/action.js):- Validates inputs (GitHub token, InstaWP credentials)
- Switches between
create-site-templateanddestroy-siteactions - Handles API interactions with InstaWP (v1 and v2 endpoints)
- Manages GitHub PR comments
-
Build Output (
dist/index.js):- Bundled version of the action for GitHub Actions runtime
- Must be rebuilt and committed after any changes to
src/action.js
- InstaWP API v2: Site creation from templates (
/api/v2/sites/git) - InstaWP API v1: Site status checking and deletion
- GitHub API: PR comment creation/updates via @actions/github
- Polls InstaWP API for site creation status (max 25 attempts, 3-second intervals)
- Creates or updates PR comments with site URLs and magic login links
- Supports both pooled sites and on-demand creation
- Outputs site URL, magic login URL, and WordPress credentials
- Accepts both INSTAWP_TEMPLATE_SLUG and INSTAWP_SNAPSHOT_SLUG (as an alias) for template identification
- The code uses mixed module syntax (ES6 imports + CommonJS require)
- No linting configuration exists
- Error handling is basic - mainly catches and logs errors
- All logic is in a single file with switch-case pattern for different actions