Hanzo AI
OpenapiGit

Create task

Hands the runner a job to execute, if its pool has one, and answers immediately either way.

POST /v1/runner/task

Addresshttps://api.hanzo.ai/v1/runner/task
MethodPOST
Operationpost_runner_task
AuthAuthorization: Bearer $HANZO_API_KEY

Hands the runner a job to execute, if its pool has one, and answers immediately either way. A runner sends the queue version it last saw; when it matches, nothing has been queued since and no lease transaction is opened.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
x-runner-uuidheaderstring
x-runner-tokenheaderstring
queuebodyinteger (int64)Queue is the queue version the runner last saw.

Response

StatusBodyMeaning
200runner.TaskOutok
defaultproblem-detailsrefused

200 body — 38 fields.

FieldInTypeAlwaysDescription
queuebodyinteger (int64)Queue is the forge's current queue version, to ask against next time.
taskbodyrunner.Task
task.contextbodyrunner.Context
task.context.actions_urlbodystringActionsURL is where act fetches an action repository from when a step names one.
task.context.actorbodystringActor is who caused the run.
task.context.api_urlbodystringAPIURL is where the job reaches the forge's API.
task.context.base_refbodystringBaseRef is the target branch of a pull request, empty otherwise.
task.context.eventbodystringEvent is the webhook payload that triggered the run, as opaque JSON.
task.context.event_namebodystringEventName is what triggered the run, e.g.
task.context.head_refbodystringHeadRef is the source branch of a pull request, empty otherwise.
task.context.jobbodystringJob is which job of the workflow document this task is.
task.context.refbodystringRef is the full ref the run is for, e.g.
task.context.ref_namebodystringRefName is that ref without its refs/heads/ or refs/tags/ prefix.
task.context.ref_typebodystringRefType is "branch" or "tag".
task.context.repositorybodystringRepository is "<owner>/<name>".
task.context.repository_ownerbodystringRepositoryOwner is the owner half of it.
task.context.retention_daysbodystringRetentionDays is how long the run's artifacts are kept, as a number in a string because that is what an expression reads.
task.context.run_attemptbodystringRunAttempt is which attempt of that run this is, counting from 1.
task.context.run_idbodystringRunID identifies the run this task belongs to.
task.context.run_numberbodystringRunNumber is the run's position in its repository, counting from 1.
task.context.runtime_tokenbodystringRuntimeToken authorizes the job against the actions runtime: artifacts, the cache.
task.context.server_urlbodystringServerURL is the forge's own origin, as a link in a log points at it.
task.context.shabodystringSha is the commit being run, in full.
task.context.tokenbodystringToken is the job's credential against the forge's own API — github.token in an expression.
task.idbodyinteger (int64)ID identifies this task on every later state and log report.
task.needsbodyrunner.Need[]Needs is what the jobs this one depends on produced.
task.needs[].jobbodystringJob is the depended-on job's id in the workflow.
task.needs[].outputsbodyrunner.Pair[]Outputs are the values it published.
task.needs[].outputs[].namebodystringName is what the value is filed under.
task.needs[].outputs[].valuebodystringValue is the value itself, always a string on this wire.
task.needs[].resultbodystringResult is how it finished.
task.secretsbodyrunner.Pair[]Secrets are the values masked out of the log and exposed as secrets.*.
task.secrets[].namebodystringName is what the value is filed under.
task.secrets[].valuebodystringValue is the value itself, always a string on this wire.
task.varsbodyrunner.Pair[]Vars are the values exposed as vars.*.
task.vars[].namebodystringName is what the value is filed under.
task.vars[].valuebodystringValue is the value itself, always a string on this wire.
task.workflowbodystringWorkflow is the workflow document verbatim.

Failure carries the platform error shape — see Errors.

Examples

hanzo runner task

Git API · All Hanzo APIs · Interactive reference

How is this guide?

On this page