All jobs

Add GitHub Actions CI to a Sequelize App

Yes. An agent reads your Sequelize and Express app, writes a workflow that installs it, seeds SQLite, starts the server and checks the API, 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 how the app is installed and run before it writes a workflow, because a CI job is only as right as the commands it copies. In an app laid out like sequelize/express-example, everything lives under express-main-example/: package.json has two scripts, start (node index.js) and setup-example-db (node sqlite-example-database/setup.js), four dependencies, express, sequelize, sqlite3 and body-parser, and an engines field asking for Node 10 or newer. There is no test script, no lint, no .github directory and no lockfile: .npmrc says package-lock=false, which rules out npm ci. sequelize/index.js opens a SQLite file at sqlite-example-database/example-db.sqlite, which .gitignore excludes, so a fresh checkout has no database until the setup script runs sequelize.sync({ force: true }) and bulk-creates four users, three orchestras and ten random instruments per orchestra. index.js calls sequelize.authenticate(), exits with code 1 if the database cannot be reached, and listens on port 8080.

The routes are generic: express/app.js mounts getAll, getById, create, update and remove from each file in express/routes under /api/<name>, wrapped so an async error reaches Express's error handler, and express/helpers.js throws a TypeError for an :id that is not all digits. routes/orchestras.js includes instruments when ?includeInstruments is present, and models/user.model.js validates username against ^\w{3,}$, which a smoke test has to respect.

With no test script to run, the agent writes a workflow that proves the app boots and answers. .github/workflows/ci.yml runs on pushes and pull requests with working-directory set to express-main-example, a matrix over the current Node LTS lines rather than the Node 10 the engines field names, since sqlite3 installs a native module and needs a Node line the package supports; it runs npm install (there being no lockfile to npm ci from), then npm run setup-example-db, then starts node index.js in the background and waits for port 8080. The checks are curl calls with --fail: GET /api/users must return 200 with four users, GET /api/orchestras?includeInstruments must return three orchestras each with an instruments array, POST /api/users with a username that satisfies the regex must return 201, GET /api/users/999 must return 404, and GET /api/users/abc must not return 200. Each check lives in scripts/smoke.sh so it runs the same way on a laptop, and the workflow calls that script.

Before opening the pull request, the agent runs the whole thing in its sandbox: npm install with the native module sqlite3 brings, the setup script with its Executing query log, the server start, and every curl with its status code, and pastes that output into the description. It does not add a test runner or a lockfile, because both are decisions for the maintainer, and says so.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Add GitHub Actions CI to this Sequelize and Express app. Read express-main-example/package.json, .npmrc, .gitignore, index.js, express/app.js, express/helpers.js, every file in express/routes and sequelize, and sqlite-example-database/setup.js first. There is no test script, so write .github/workflows/ci.yml that, in express-main-example on the current Node LTS lines, runs npm install, runs the setup-example-db script, starts the server in the background, waits for port 8080 and runs a smoke script you add at scripts/smoke.sh: GET /api/users returns 200 with four users, GET /api/orchestras?includeInstruments returns three orchestras with instruments, POST /api/users with a valid username returns 201, GET /api/users/999 returns 404 and GET /api/users/abc does not return 200. Run the install, the setup, the server and the smoke script in the sandbox and open a pull request with the output. Do not add a lockfile or a test runner.",
  "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

The pull request adds .github/workflows/ci.yml and express-main-example/scripts/smoke.sh, and nothing else. Its description pastes the npm install output including the sqlite3 native module install, the setup script's log, the server's start-up line and each curl with its status code and a trimmed body, and explains why the matrix skips the Node version in engines.

The new CI workflow runs on the pull request itself, so the reviewer sees the smoke script pass on a GitHub runner for each Node line before merge. There was no check before, so this is the repository's first.

Before merging, a reviewer decides whether to commit a lockfile so the job can use npm ci and the install becomes reproducible, whether engines should be raised to match the matrix, and whether the smoke script should become a real test suite, which the agent offers as a follow-up with Supertest.

Run it on every new repository

A team that starts services from this example sends this body once per new repository from its own server, with the repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own package.json: a repository that has grown a test script gets a job that runs it instead of the smoke script, one on Postgres gets a services block with a postgres container and a DATABASE_URL, and one with a lockfile gets npm ci.

Afterwards, an automation on the Project with a github trigger on workflow_run.failure and the prompt "read the failed CI run's log, find the first failing step, and comment on the pull request with the cause and the fix" keeps the new workflow from being ignored when it goes red. Automation runs are read-only, so the comment is all it posts, and only work by an owner, member or collaborator fires it.

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

Why run it on Rush?

A CI workflow for an app with no tests is still worth having, and still easy to get wrong: npm ci against a repository whose .npmrc forbids a lockfile, a Node version from engines that cannot build sqlite3, a server started with nothing waiting for its port. The agent reads those files, runs the same commands in its own sandbox and keeps the output, so the workflow that lands is one that has already passed once.

The install log, the seed log, the server's start-up line and every curl stay with the run and are pasted into the pull request. A team that owns several services started from the same example runs this across all of them at once, each in its own sandbox with its own pull request.

Frequently asked questions

Why not npm ci?

Because express-main-example/.npmrc sets package-lock=false and the repository has no lockfile, and npm ci refuses to run without one. The workflow uses npm install, and the pull request suggests committing a lockfile as the first follow-up so the install becomes reproducible and the job can switch.

Why does the matrix not use Node 10?

Because engines names the oldest Node the example was written for, not what a runner should test. sqlite3 installs a native module and needs a Node line the package supports, and the current LTS lines are that. The description names the gap so a maintainer can raise engines in the same change or later.

What happens when a check fails?

Each curl in scripts/smoke.sh runs with --fail and the script runs under set -e, so the first wrong status code ends the job with that call's output in the log. The server runs in the background with its log captured, so the failing request can be matched to the query Sequelize ran, which logQueryParameters and benchmark in sequelize/index.js already print.

Does the job need a database service?

No. The app uses SQLite through a file the setup script creates, so the runner needs nothing but Node. An app that had moved to Postgres by changing the Sequelize constructor would get a services block instead, and the agent reads sequelize/index.js to tell which it is.

More Sequelize jobs

The same job on other stacks

Keep reading