What the agent does
The agent reads the action before touching it, because a job summary is written from the action's own code and this repository checks that code in twice. In an action laid out like actions/typescript-action, action.yml declares one input, milliseconds, with a default of '1000', one output, time, and runs dist/index.js on node24. src/main.ts reads the input with core.getInput, logs with core.debug, waits, sets the output with core.setOutput('time', …) and calls core.setFailed in its catch. Nothing in it writes a summary, so a workflow that uses the action gets an empty summary page and has to read the log.
The change in src/main.ts is a few lines after setOutput: core.summary.addHeading(…), addTable(…) with the input and the output as rows, and await core.summary.write(). @actions/core is already a dependency at ^3.0.0, so nothing new is installed. The summary call goes inside the existing try, so a write failure reaches core.setFailed like any other error rather than an unhandled rejection in a service that otherwise reports cleanly.
The tests are where this repository is particular. __tests__/main.test.ts never loads the real @actions/core: it calls jest.unstable_mockModule('@actions/core', () => core) with the module from __fixtures__/core.ts, which exports jest.fn() doubles for debug, error, info, getInput, setOutput, setFailed and warning and nothing else. Once main.ts touches core.summary, that fixture answers undefined and both existing tests fail. So the agent adds a summary double to the fixture whose addHeading and addTable return the same object and whose write resolves, and adds a test asserting write is called once and the table rows carry the milliseconds value getInput was mocked to return. It runs them with npm run ci-test, which sets NODE_OPTIONS=--experimental-vm-modules for the ESM mocks.
Then it rebuilds the bundle. check-dist.yml removes dist/, runs npm run bundle and fails the pull request if git diff on dist/ shows anything, so a change to src/main.ts without a matching dist/index.js and dist/index.js.map is a red check. npm run bundle runs prettier --write . and then rollup with @rollup/plugin-typescript from rollup.config.ts; the agent runs it in its sandbox and commits the rebuilt files. The test-action job in ci.yml uses the action from ./ with milliseconds: 2000, so the pull request's own checks are the first place the summary appears.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Make this GitHub Action write a job summary. Read action.yml, src/main.ts, __fixtures__/core.ts, __tests__/main.test.ts, package.json, .github/workflows/ci.yml and .github/workflows/check-dist.yml first. In src/main.ts, after the output is set, write a summary with a heading and a table of the inputs and the time output using core.summary, inside the existing try block. Add a summary double to __fixtures__/core.ts so the mocked module still works, and add a test that the summary is written with the milliseconds value. Run npm run ci-test, npm run lint and npm run format:check, then npm run bundle so dist/ is rebuilt, and commit dist. Quote the test output. Open a pull request.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- 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.
- 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.
- 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 five files changed: src/main.ts, __fixtures__/core.ts, __tests__/main.test.ts, and the rebuilt dist/index.js and dist/index.js.map. The description quotes npm run ci-test with the new test listed among the passing ones, and names the check-dist workflow as the reason dist/ is in the diff.
On the pull request, ci.yml runs the test-action job with the action itself, so the summary shows up on that job's run page with the 2000 milliseconds the workflow passes and the time it set. check-dist, the super-linter job in linter.yml and CodeQL run as they do on every pull request; the agent ran prettier, eslint and the format check in its sandbox so the linter job has nothing new to flag.
Before merging, a reviewer looks at the summary on the test-action job and decides what else belongs in the table, since the agent wrote only what action.yml declares.
Run it on every new repository from the template
A team that stamps new actions from this template sends one POST /o/{org}/sessions per new repository with this body and the repository's URL in resources. Each run reads that action's own action.yml, so an action with three inputs gets a table with three rows, and each opens its own pull request.
Send a request_id, a UUID, with each call so a retried request returns the run it already started. Give the key a webhook_url and Rush POSTs run.completed when a run's turn ends, with session_url to read the pull request from, or run.failed when it did not get there.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A job summary is a small change with three places to get wrong: the fixture that stands in for @actions/core in tests, the dist/ bundle that check-dist compares byte for byte, and the formatter that super-linter enforces. Done by hand between other work, one of them is usually forgotten and the pull request goes red. In its own sandbox the agent runs the tests, the lint, the format check and the bundle in order and commits what they produce.
Every command and its output stay with the run, and the pull request quotes the test run, so the reviewer sees the new assertion pass rather than taking it on faith. The same request works on any repository made from the template, in parallel, one sandbox and one pull request each.
Frequently asked questions
Why do the existing tests break when main.ts uses core.summary?
Because the tests replace the whole @actions/core module with __fixtures__/core.ts, which only defines the functions the action used so far. core.summary is undefined in that double until the fixture gains one, which is why the agent extends the fixture rather than the test alone.
Why is dist/ in the pull request?
The action runs dist/index.js, not src/main.ts, and check-dist.yml rebuilds dist/ on every pull request and fails if the committed copy differs. A source change without the rebuilt bundle is a failing check and an action that still writes no summary.
What happens when the summary cannot be written?
core.summary.write() needs the GITHUB_STEP_SUMMARY file the runner provides. The call sits inside the action's try, so if it throws, core.setFailed reports it like any other error instead of leaving an unhandled promise.
Does this change the action's inputs or outputs?
No. action.yml is untouched; the summary reports the milliseconds input and the time output that already exist. Adding a column for a new input is a later change to both files.
More GitHub Actions jobs
More jobs like this: Hand off a long task
- Add a JSON Output Flag to a Cobra CLI (Cobra)
- Add JSON Output to a Go Command-Line Tool (Go CLI)
- Publish a TypeScript Library to JSR Alongside npm (TypeScript library)