Run Cursor agents in GitHub Actions using the official @cursor/sdk. An independent project, not affiliated with or endorsed by Cursor.
- Add a repository secret named
CURSOR_API_KEY. - Use the action in a workflow job.
- Read
steps.<id>.outputs.summaryfor the model response.
- name: Run Cursor Agent
id: cursor
uses: PunGrumpy/cursor-action@v1
with:
api-key: ${{ secrets.CURSOR_API_KEY }}
prompt: "Review this PR for security issues and summarize your findings."
- name: Print summary
env:
SUMMARY: ${{ steps.cursor.outputs.summary }}
run: echo "$SUMMARY"The action runs on ubuntu-latest, windows-latest, and macos-latest.
| Input | Required | Default | Description |
|---|---|---|---|
cursor-version |
❌ | latest |
(Deprecated) The SDK automatically manages the agent version. |
api-key |
✅ | — | Cursor API key for authentication |
prompt |
✅ | — | Prompt to pass to cursor-agent |
model |
❌ | default |
Model id for the agent (e.g. default, composer-2). The Cursor SDK does not accept auto. |
working-directory |
❌ | . |
Working directory for the agent to operate in |
permissions |
❌ | read-only |
Validated but NOT enforced: 'read-only' does not stop the agent from editing files or running shell commands. Wired to the SDK in v2. |
timeout |
❌ | 300 |
Timeout in seconds for the agent run |
| Output | Description |
|---|---|
summary |
Text summary returned by the cursor-agent |
exit-code |
Exit code from the cursor-agent process |
Warning
permissions does not restrict the agent today. The value is validated and then discarded — tool access follows whatever your API key and account allow, so read-only does not stop the agent from editing files or running shell commands. It is wired to the SDK's tool restrictions in v2.
Important
Treat summary as untrusted model output. Pass it through env: rather than interpolating ${{ steps.<id>.outputs.summary }} directly into a run: script or a github-script body — interpolation splices the text into the script before it executes.
Worked examples, what the action does at runtime, and troubleshooting live in docs/, which is published as the documentation site. The tables above are generated from action.yml by the same script that generates the site's reference page, so neither can drift from the manifest.
- Node.js 24 (matches CI and release workflows)
- Bun
bun install
bun run typecheck
bun run test
bun run builddist/ is committed on purpose — GitHub Actions executes it straight from the tag. If you changed anything under src/, run bun run build and commit the result; CI fails when dist/ is out of date. The bundle only contains this repository's own code (a few KB); @actions/core and @cursor/sdk stay external and are installed by the action at runtime, so package-lock.json must stay in sync with package.json.
bun run docs:reference # regenerate the reference tables from action.yml
bun run docs:dev # http://localhost:3000docs/ is a separate Fumapress project with its own lockfile, so bun install at the repository root does not pull in its dependencies.
export GITHUB_STEP_SUMMARY="$(mktemp)"
export GITHUB_OUTPUT="$(mktemp)"
env "INPUT_API-KEY=$CURSOR_API_KEY" \
"INPUT_PROMPT=Say 'smoke test passed' and nothing else." \
"INPUT_MODEL=default" \
"INPUT_PERMISSIONS=read-only" \
"INPUT_TIMEOUT=60" \
node dist/index.mjsCIrunstypecheck,lint,test,build, and adist/freshness check on every push and pull request. TheDocsjob regenerates the reference fromaction.yml, typechecks the site, and builds it.- The
Integrationjobs install the action's runtime dependencies and run it with an invalid key on Ubuntu, Windows, and macOS. Being rejected at authentication is the pass condition: it proves the dependency tree resolves and the SDK reaches Cursor, without spending an agent run. Smoke Testruns the action for real and needs aCURSOR_API_KEYon a paid plan, so it only runs from the Actions tab (workflow_dispatch).Releaseruns Changesets on pushes tomainto open a release PR or publish, then moves thev1tag to the published version.uses: PunGrumpy/cursor-action@v1tracks the latestv1.x.x. Pin a full tag or a commit SHA if you want a frozen version.
This project uses Changesets. See .changeset/README.md for the contribution workflow.