All jobs

Set Up GitHub Actions CI for a Hono Worker

Yes. An agent reads your Hono Worker's scripts and Vitest setup, adds a workflow that runs tests, type checks and a wrangler dry-run deploy, and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the repository's shape before it writes a workflow, because a Hono repository is often several Workers in one tree. In a repository shaped like honojs/examples, the root package.json declares npm workspaces for basic, blog, durable-objects, jsx-ssr, pages-stack, nextjs-stack, hono-vite-jsx, env-vars and stytch-auth, pins packageManager to npm@10.0.0, and the only file under .github/ is dependabot.yml, which checks npm daily. .gitignore lists package-lock.json, yarn.lock, bun.lockb and deno.lock, so there is no lockfile to feed npm ci. That one line decides the install step: the agent either commits a lockfile and removes it from .gitignore, or runs npm install and says in the pull request why the build is not reproducible yet.

Only two workspaces have a test script, both vitest --run. basic runs Vitest with globals: true from vitest.config.ts, types from vitest/globals and @cloudflare/workers-types in tsconfig.json, and one case in src/index.test.ts that calls app.request('http://localhost/') and checks the status and the x-powered-by header. blog runs inside workerd through defineWorkersConfig from @cloudflare/vitest-pool-workers, with vitest pinned to 1.3.0 and wrangler: { configPath: './wrangler.toml' }, but the repository only commits wrangler.example.toml; its README says to rename it, so CI has to copy it before the tests can start. blog has typescript ^5.4.5 as a dev dependency and basic has none, which matters for a type check step.

The agent writes .github/workflows/ci.yml on pull_request and push to main with one job: actions/setup-node on Node 20, npm install at the root, cp wrangler.example.toml wrangler.toml in blog, then npm test --workspaces --if-present so the workspaces without a test script are skipped rather than failing. It adds npx tsc --noEmit in blog and, after adding typescript to its dev dependencies, in basic, and npx wrangler deploy --dry-run --outdir dist in the Worker workspaces so a bundling error surfaces without a Cloudflare account. The nextjs-stack and pages-stack workspaces get their build script in the same job, since that is the only check they have.

Before pushing, the agent runs the same commands in the sandbox in the same order and keeps the output. wrangler deploy --dry-run writes the bundle it would upload and exits, which is enough to catch a missing binding type or a bad import; it does not need CLOUDFLARE_API_TOKEN, and the workflow sets no secrets.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "codex",
  "input": "Add a GitHub Actions workflow to this Hono repository and open a pull request. Read the root package.json, .gitignore, .github/dependabot.yml, and in each workspace the package.json, wrangler.toml or wrangler.example.toml, tsconfig.json, vitest.config.ts and any test file. Write .github/workflows/ci.yml that runs on pull_request and push to main on Node 20, installs at the root, copies blog/wrangler.example.toml to blog/wrangler.toml, runs npm test --workspaces --if-present, runs npx tsc --noEmit in every workspace that has typescript as a dev dependency, adds typescript to basic so it is checked too, and runs npx wrangler deploy --dry-run --outdir dist in each Worker workspace. If the repository ignores lockfiles, use npm install and explain in the pull request what committing a lockfile would change; do not remove entries from .gitignore. Run every step in the sandbox first and paste the test and dry-run output in the pull request. Do not change any source file.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request with .github/workflows/ci.yml, one dev dependency added to basic/package.json, and nothing else under any workspace. The description pastes the Vitest output for basic and blog, the tsc --noEmit result for each, and the dry-run line from wrangler naming the bundle it would have uploaded for each Worker.

The workflow runs on the pull request that adds it, so the first green check is the workflow checking itself. On a repository with no lockfile the install step is npm install, and the description says what to commit to turn it into npm ci.

A reviewer checks that the blog tests actually ran inside workerd rather than being skipped, that the copied wrangler.toml is not committed, and that the dry-run step covers every workspace with a wrangler.toml. Then they merge and make the check required.

Run it on every new Hono workspace

A team that keeps one Worker per workspace sends one POST /o/{org}/sessions per repository with this prompt and the repository in resources. Each run reads its own workspaces, so a tree with a bun or deno example gets those left out of the npm steps with a note, and each opens its own pull request.

Give the key a webhook_url and Rush POSTs run.completed when each turn ends, with session_url to read the pull request from. Every Hono repository in a batch can be posted at once even though a key holds max_concurrent runs in progress, four by default and at most 100; the rest are answered 202 with status: "queued" and start, oldest first, when a slot frees.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

A workflow for a workspaces repository fails in the details: a test script that only two workspaces have, a config file that is only an example, a tsc that is not installed where it is called. In a Rush sandbox the agent runs every step before pushing, with real Vitest, workerd and wrangler output kept in the run's record, so the pull request shows the commands passing rather than promising they will.

The change is one file plus a dev dependency, but reading nine workspaces to get it right takes longer than writing it. The agent does that in one pass and the same request works unchanged on the next Hono repository.

Frequently asked questions

Why npm install and not npm ci?

Because .gitignore in a repository like honojs/examples lists every lockfile, and npm ci refuses to run without one. The agent uses npm install and explains in the pull request that committing package-lock.json would make installs reproducible and let actions/setup-node cache them.

Does the dry-run deploy need a Cloudflare account?

No. wrangler deploy --dry-run bundles the Worker and exits without contacting the API, which is why the workflow sets no secrets. A real deploy stays a separate, manual step or a separate workflow.

What about the workspaces without tests?

npm test --workspaces --if-present skips them instead of failing. The nextjs-stack and pages-stack workspaces have a build script, which the workflow runs so they get at least a compile check; the pull request lists which workspaces have no check at all.

Will it change my wrangler.toml?

No. The workflow copies blog/wrangler.example.toml into place at CI time only, because vitest.config.ts points at ./wrangler.toml and the file is not committed. Nothing is added to the repository under that name.

More Hono jobs

The same job on other stacks

Keep reading