GitHub Actions
Start a GitHub Actions workflow when a person approves a task, and create tasks from any workflow with the TaskToHuman GitHub Action.
Two directions#
TaskToHuman works with GitHub Actions both ways:
- A decision starts a workflow. A task type can start a workflow in one of your repositories when a task finishes: a
workflow_dispatchrun of a workflow file on a branch or tag, or arepository_dispatchevent. By default only when a person approves. Set it up in the app, under the task type's After the answer, in GitHub Actions. - A workflow creates a task. The TaskToHuman GitHub Action creates a task from any workflow step, with fields filled from the run. It can end there (the decision then starts another workflow, as above) or wait for the decision and hand it to the next steps.
Typical uses:
- Release approvals. CI builds and tests, then asks a person; approving on the phone starts the deploy workflow with exactly what was tested.
- Data entry. A workflow needs something only a person knows (release notes, a version number, a go-live date) and asks for it as human inputs.
- Reviews and sign-off. A content, legal or security change is published only after someone signed it off.
Starting workflows is part of every plan (the callback.github feature). Filling the inputs from a payload template is on plans that include custom payloads.
Start a workflow when a person decides#
Set it up#
- In GitHub, create a fine-grained personal access token for the repository (Create the token).
- In the app, open the task type, then After the answer, then GitHub Actions.
- Choose what to start: Run a workflow (
workflow_dispatch) or Send a repository event (repository_dispatch). - Enter the Repository as
owner/repo, then either the Workflow file (deploy.yml, or the workflow's numeric id) and the Branch or tag (main), or the Event type (content.signoff). - Choose when: When a person approves (or completes) the task, the default, or Whatever the outcome.
- For a workflow: Map inputs, each to a fixed text or a task value (What is sent), or take them from a template (Inputs from a template).
- Save the task type. Configure everything first: any later change to the GitHub Actions settings removes the token (Create the token).
- Choose Add token and paste the token, last. It is stored encrypted and never shown again.
- Choose Check connection.
The starter template Release approval (GitHub Actions) creates an approval task type with this set up for a workflow on main: fill in the repository and workflow, map the inputs, save, then add the token. Remove GitHub Actions removes the destination and its token.
The workflow must already exist on the repository's default branch and declare the trigger: on: workflow_dispatch with its inputs, or on: repository_dispatch with the event type under types. GitHub requires both.
Check connection reads the workflow (or, for repository events, the repository) with the saved token. It proves that the token is valid, can reach the repository and that the workflow file exists. It can't prove the write permission without starting a run: the first real run does. You can check 10 times an hour per task type.
Preview what is sent shows the address, the headers (the token hidden) and the body for an approved, rejected or expired sample task.
Create the token#
In GitHub: Settings, then Developer settings, Personal access tokens, Fine-grained tokens, Generate new token.
| Setting | Choose |
|---|---|
| Resource owner | The user or organization that owns the repository. |
| Repository access | Only select repositories, and select the one repository. |
| Repository permissions | Actions: Read and write to run a workflow, or Contents: Read and write to send a repository event. Metadata: Read-only is added by GitHub. |
| Expiration | Your choice, up to 366 days. When it expires, GitHub refuses the requests (http_401) until you add a new token. |
Classic tokens (ghp_…) are accepted, but they reach every repository you can: use a fine-grained token (github_pat_…).
The token belongs to the task type and to the exact GitHub Actions settings it was saved with. Any change to them removes the token in the same save: the repository, what to start, the workflow, the branch or tag, the event type, when it is sent, the inputs or the template. The app warns you before saving, and you add the token again afterwards. So set everything up first and add the token last. This way nobody who may edit the task type can make your token start another workflow, on another branch or with other inputs: a branch's workflow runs with the repository's secrets.
A delivery created before such a change is never sent and can't be retried (github_destination_changed): it was built for the old settings. Create a new task if the workflow still has to run.
The app shows the token's last 4 characters, when it was added and by whom. You can replace or remove it; nobody can read it, our support staff included. Every change is recorded in the task type's history, without the token.
When it is sent#
| When | Starts the workflow |
|---|---|
| When a person approves (default) | When a person decides with approved, edited or done (a follow-up completed), and decision.automatic is false. A rejection, a hand-back, an expiry, a cancellation and every automatic decision start nothing, even a default action that approves on expiry. |
| Whatever the outcome | Every final outcome. Map decision.action and decision.automatic to inputs and let the workflow decide. |
Test tasks never start a workflow: a test approval must not start a real deploy. When nothing is sent, the task's history says why: the outcome wasn't selected, it is a test task, or the plan doesn't include it (starting workflows, or the custom payloads an inputs template needs).
The destination is read from the task type when the task finishes, so a fix to the mapping also applies to tasks still open (add the token again after saving the fix). A task type can have a callback URL, a GitHub destination, both or neither. A task's own callback_url replaces only the callback URL; the GitHub destination always applies.
What is sent#
Run a workflow posts to https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow}/dispatches:
{ "ref": "main", "inputs": { "images": "caddy@sha256:9f2c…", "task_id": "01a1e3a7-6489-7106-aa3a-c976287f9999" } }Up to 25 inputs. A name starts with a letter or _, then letters, digits, _ and -, up to 100 characters, and matches the input the workflow declares. Each value is a fixed text (up to 1,000 characters) or one task value:
| Value | Meaning |
|---|---|
task.id, task.type, task.title, task.state, task.urgency, task.created_at, task.finished_at, task.url, task.test, task.escalations | The task. task.type is the key; task.url opens the task in the app. |
task.payload.<key> | A field as the task was created. |
decision.action, decision.automatic, decision.reason, decision.at, decision.comment, decision.by.id, decision.by.name | The decision. decision.comment is written by a person. |
decision.payload.<key> | An edited value (empty when not edited). |
decision.fields.<key> | A human input. |
result.<key> | The edited value if the approver edited the field, otherwise the value as created. |
callback.id | This delivery's id, the same on every retry. |
Every value is sent as text: numbers as digits, yes or no as true or false, nothing as an empty string. Sensitive fields can't be mapped. All inputs together are at most 65,535 characters, as GitHub allows; a larger set fails without being sent (github_payload_too_large).
Send a repository event posts to https://api.github.com/repos/{owner}/{repo}/dispatches with your event type and a client_payload of four parts:
{
"event_type": "content.signoff",
"client_payload": {
"task": { "id": "01a1e3a7-6489-7106-aa3a-c976287f9999", "type": "content_signoff", "title": "Publish the pricing page?", "test": false, "url": "https://app.tasktohuman.com/tasks/01a1e3a7-6489-7106-aa3a-c976287f9999" },
"decision": { "action": "approved", "automatic": false, "reason": null, "at": "2026-11-16T09:19:54.377Z", "by": { "id": "01a1dcba-b57a-7aa2-b6b1-05d81545c2ba", "name": "Ana" }, "comment": "Good to go." },
"payload": { "path": "content/pricing.md", "pull_request": "https://github.com/acme/site/pull/42" },
"fields": {}
}
}payload holds the task's fields as created, without sensitive fields; fields the human inputs. The workflow reads them as github.event.client_payload.*. When the whole object would be over 60,000 bytes, payload, then fields, then decision.comment are left out in that order, and "omitted": ["payload"] (and so on) says which: read the rest with GET /v1/tasks/{id}. GitHub runs repository events on the default branch.
With a template. On plans that include custom payloads, choose Inputs from a template instead of mapping them: a payload template renders the inputs object (flat: text, number, yes or no, or null values, up to 25 names; values are sent as text) or the whole client_payload (up to 10 top-level properties, under 60,000 bytes). The address, ref and event_type always come from the settings, never from the template. A template that breaks for a real task fails that delivery with payload_template_failed; fix the template, then retry the delivery from the task. If the plan no longer includes custom payloads, a destination that takes its inputs or client_payload from a template starts nothing: the task's history records it as not in the plan, and the template is kept. Switch back to Map inputs (which works on every plan) or change plan. Nothing is ever sent in another shape instead.
The request carries Authorization: Bearer <your token>, Accept: application/vnd.github+json and X-GitHub-Api-Version: 2026-03-10. Your custom headers are never sent to GitHub. The token is not part of any callback, log, export or history.
Results and retries#
GitHub's answer is shown on the task in the app, with a link to the workflow's runs. Deliveries are retried on the callback schedule for 24 hours; after a 403 or 429 the next attempt waits at least a minute, as GitHub asks.
| Result | Retried | What it means |
|---|---|---|
200 or 204 | – | GitHub accepted it and the workflow run started. It says nothing about whether the run passes. |
http_401 | Yes | GitHub refused the token: it is wrong, expired or revoked. Add a new token; the next retry uses it. |
http_403 | Yes | The token lacks the permission (Actions: write for workflows, Contents: write for repository events), or GitHub's rate limit was reached. |
http_404 | Yes | GitHub can't find the repository or workflow, or the token has no access to that repository (GitHub answers "not found" then). |
http_422 | Yes | The workflow has no workflow_dispatch trigger, the branch or tag doesn't exist, or the inputs don't match the workflow's inputs. |
http_429 | Yes | GitHub's rate limit was reached. |
http_500 and the other 5xx, timeout, connect_failed | Yes | GitHub didn't answer. |
github_token_missing, github_token_unreadable | Yes | No token is saved for this task type, or it couldn't be read. Add the token under After the answer, GitHub Actions; the next retry uses it. |
github_payload_too_large | No | The inputs are larger than GitHub accepts (65,535 characters). Map fewer or shorter values. |
payload_template_failed | No | The inputs template failed for this task. Fix it, then retry from the task: it renders again. |
github_destination_changed | No | The GitHub Actions settings changed after this delivery was created, so it is never sent. Create a new task. |
feature_not_in_plan | Yes | The plan doesn't include starting GitHub workflows. |
You can retry a failed delivery from the task in the app, except github_destination_changed. Our support staff can't retry or replay a GitHub delivery: only you can start your workflows.
Make the workflow safe to run twice#
GitHub has no idempotency key for dispatches. When an attempt times out after GitHub accepted it, the retry starts a second run. Make the workflow idempotent (deploying the same image twice changes nothing), or map callback.id to an input and use it in a concurrency group so the two runs never overlap.
Security#
- Use a fine-grained token for one repository, with only the permission the mode needs. Give it an expiry and add a new one in time.
- The token is bound to the GitHub Actions settings it was saved with: any change removes it (Create the token).
- Workflow inputs and
client_payloadappear in the run's logs and event data, which anyone who can read the repository can see. Don't map personal data you wouldn't show them; sensitive fields can't be mapped at all, and secrets belong in GitHub's encrypted secrets, never in a task. decision.comment, human inputs and edited values are written by people. Never put them into arun:script with${{ }}: pass them throughenv:and use the variable, as GitHub's security guide advises against script injection.- Test tasks never start a workflow, and our support staff can't trigger one.
Create tasks from a workflow#
The TaskToHuman GitHub Action creates a task from a workflow step, outputs its id and link, and can wait for the decision. It is a JavaScript action without dependencies: it runs on GitHub-hosted runners and on self-hosted runners (version 2.328.0 or later, Linux, macOS or Windows) with nothing else to install. It is listed in the GitHub Marketplace: TaskToHuman.
- uses: MobiusApps/tasktohuman-action@<full commit SHA> # v1.0.0
with:
api-key: ${{ secrets.TTH_API_KEY }}
task-type: approve_release
fields: |
image=ghcr.io/acme/app@${{ steps.build.outputs.digest }}
run_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}Pin the full commit SHA of a release, as GitHub advises for actions of other parties; each version is tagged v<version> and named with its commit in the releases of the action's repository, MobiusApps/tasktohuman-action, which also holds its source. To follow a major version instead, use @v1. Store the API key as a repository or environment secret; a test key (tth_test_…) notifies only you (Test mode).
Inputs#
| Input | Default | Meaning |
|---|---|---|
api-key | required | A workspace API key, tth_live_… or tth_test_…. Masked in the log. |
task-type | required | The task type's key. |
title | the task type's name | Up to 200 characters. |
payload | – | The fields as a JSON object. |
fields | – | The fields as key=value lines (the value is the rest of the line). Number and yes-or-no fields are converted from the task type's field types. With payload, fields wins for the same key. |
deadline-minutes, owner, urgency, callback-url | – | As in POST /v1/tasks. |
approvers, chain | – | JSON, as in POST /v1/tasks. |
idempotency-key | – | Sent as Idempotency-Key (Idempotency). A replay returns the same task and sets replayed to true. |
cancel-previous | false | After creating, cancel this task type's open tasks created before this one: a release approval superseded by a newer build. Use a task type for one pipeline only. A failure here is only a warning: the new task exists. |
wait | false | Wait for the decision. |
wait-timeout-minutes | 60 | 1 to 355 (GitHub stops a step after 360 minutes). |
poll-interval-seconds | 15 | 5 to 300. |
cancel-on-timeout | false | Cancel the task when the wait times out. |
fail-unless-approved | true | When waiting: the step fails unless a person approved, approved with edits or completed the task. |
api-url | https://api.tasktohuman.com | |
app-url | https://app.tasktohuman.com | For the task-url output. |
Outputs#
| Output | Meaning |
|---|---|
task-id | The task's id. |
task-url | The task in the app. |
state | The task's state. |
replayed | true when idempotency-key returned an existing task. |
action, automatic, decided-by, decided-at | When waiting: the decision. |
fields | When waiting: the human inputs, as JSON. |
payload | When waiting: the edited values, as JSON. |
comment | When waiting: the person's comment. |
timed-out | When waiting: true when the wait ended before a decision. |
A refusal stops the step with the API's code and title (and the field messages) as an error annotation. A 429 is retried after its Retry-After, a 5xx or a lost connection after a short pause, up to 3 times. Creating a task always sends an Idempotency-Key (yours, or one the action makes up), so a retry never creates a second task.
Wait or dispatch#
- Wait (
wait: "true"): one run asks and waits. It holds a runner the whole time, which is fine for short decisions on GitHub-hosted runners. - Dispatch: the run creates the task and ends; the person's decision starts another workflow through the task type's GitHub destination. Right for decisions that take hours, and for a single self-hosted runner that must not sit idle waiting.
Examples#
Release approval#
CI asks for approval of exactly the image it tested; approving it starts deploy.yml with that image. The task type approve_release has the fields image (text, required, not editable, so nobody can change what is deployed) and run_url (url), and a GitHub destination: Run a workflow, repository acme/infra, workflow deploy.yml, branch main, When a person approves, inputs image = task.payload.image and delivery_id = callback.id.
ask-for-approval:
needs: test
runs-on: self-hosted
steps:
- uses: MobiusApps/tasktohuman-action@<full commit SHA> # v1.0.0
with:
api-key: ${{ secrets.TTH_API_KEY }}
task-type: approve_release
title: Deploy ${{ github.sha }}?
fields: |
image=${{ needs.test.outputs.image }}
run_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
idempotency-key: release-${{ github.sha }}
cancel-previous: "true"on:
workflow_dispatch:
inputs:
image:
description: Image to deploy
required: true
type: string
delivery_id:
type: string
concurrency:
group: deploy-${{ inputs.delivery_id }}
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deploy
env:
IMAGE: ${{ inputs.image }}
run: ./deploy.sh "$IMAGE"The run ends after creating the task, so the runner is free while the approver decides. A newer build cancels the older request (cancel-previous), and a rejected or expired task deploys nothing.
Ask a person for data, and wait#
The task type release_notes is a follow-up with a field version (text) and a human input notes (long text). The workflow waits up to an hour for it.
jobs:
release:
runs-on: ubuntu-latest
steps:
- id: ask
uses: MobiusApps/tasktohuman-action@<full commit SHA> # v1.0.0
with:
api-key: ${{ secrets.TTH_API_KEY }}
task-type: release_notes
title: Release notes for ${{ github.ref_name }}
fields: version=${{ github.ref_name }}
idempotency-key: notes-${{ github.ref_name }}
wait: "true"
wait-timeout-minutes: 60
cancel-on-timeout: "true"
- name: Publish the release
env:
NOTES: ${{ fromJSON(steps.ask.outputs.fields).notes }}
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" --notes "$NOTES"The notes reach the script through env:, never inside run:. If nobody completes the task within the hour, it is cancelled and the step fails (fail-unless-approved).
Content sign-off with a repository event#
A change under content/ asks for sign-off; the decision sends a repository event. The task type content_signoff has the fields path and pull_request and a GitHub destination: Send a repository event, repository acme/site, event type content.signoff, Whatever the outcome.
on:
pull_request:
paths: ["content/**"]
jobs:
ask:
runs-on: ubuntu-latest
steps:
- uses: MobiusApps/tasktohuman-action@<full commit SHA> # v1.0.0
with:
api-key: ${{ secrets.TTH_API_KEY }}
task-type: content_signoff
title: Sign off ${{ github.event.pull_request.title }}
fields: |
path=content/
pull_request=${{ github.event.pull_request.html_url }}
idempotency-key: signoff-${{ github.event.pull_request.head.sha }}on:
repository_dispatch:
types: [content.signoff]
jobs:
record:
runs-on: ubuntu-latest
steps:
- name: Comment on the pull request
env:
ACTION: ${{ github.event.client_payload.decision.action }}
AUTOMATIC: ${{ github.event.client_payload.decision.automatic }}
BY: ${{ github.event.client_payload.decision.by.name }}
PR: ${{ github.event.client_payload.payload.pull_request }}
GH_TOKEN: ${{ github.token }}
run: |
if [ "$ACTION" = "approved" ] && [ "$AUTOMATIC" = "false" ]; then
gh pr comment "$PR" --body "Signed off by $BY in TaskToHuman."
else
gh pr comment "$PR" --body "Not signed off ($ACTION)."
fiThe workflow checks decision.automatic because Whatever the outcome also sends expiries and default actions.