GitHub Actions
Start a Hecaton workspace on a pull request branch and let the job wait for its result.
Configure the repository
- Register the repository as a Hecaton project. Create a CI token limited to that project.
- In GitHub, create an environment named
hecaton-ciand add its secretHECATON_TOKEN. Add variablesHECATON_PROJECT_IDandHECATON_CLI_VERSIONwith the project ID and a published CLI version. - Restrict the environment to trusted workflow runs. If contributors can edit workflows, require an environment reviewer who checks the workflow from the pull request before releasing the token. Use this example for pull requests from the same repository. It does not check out their code on the runner. GitHub environments.
Add the workflow
Save the following as .github/workflows/hecaton.yml.
name: Hecaton review
on: pull_request
permissions: {}
jobs:
hecaton:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
environment: hecaton-ci
timeout-minutes: 20
steps:
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: Install Hecaton
env:
HECATON_CLI_VERSION: ${{ vars.HECATON_CLI_VERSION }}
run: npm install --global --ignore-scripts "@hecaton-io/cli@${HECATON_CLI_VERSION:?}"
- name: Wait for Hecaton
env:
HECATON_TOKEN: ${{ secrets.HECATON_TOKEN }}
HECATON_PROJECT_ID: ${{ vars.HECATON_PROJECT_ID }}
BRANCH: ${{ github.head_ref }}
run: |
: "${HECATON_TOKEN:?}"
if printf '%s\n' '{"resultContract":{"fields":{"summary":{"type":"string"}}}}' |
hecaton workspace create --body-file - --project "${HECATON_PROJECT_ID:?}" --branch "${BRANCH:?}" \
--prompt "Review this branch and publish a summary. Do not edit the code." \
--idempotency-key "github-${GITHUB_REPOSITORY_ID}-${GITHUB_RUN_ID}" \
--wait --timeout 900 --json > hecaton.jsonl; then
head -n 1 hecaton.jsonl
tail -n 1 hecaton.jsonl
else
status=$?
head -n 1 hecaton.jsonl
tail -n 1 hecaton.jsonl
exit "$status"
fiRead the result
The first line identifies the workspace after admission. The last line is the result document on success or the CLI error on failure. Only log results your CI audience may read. Exit 4 leaves a question in Hecaton, and exit 124 ends the job's wait while Hecaton continues. Use the workspace ID to read its state and results. The same workflow run keeps its idempotency key on retry.