# Send a failed GitHub Actions run to your inbox

> A step that runs only when a job fails sends one message with the repository, branch, commit, job and a link to the run, to your own inbox or to an agent of yours.

Page: https://tryhoming.com/guides/ci-failure
Section: Learn / Guides
Updated: 2026-11-23

## What it does

The step runs after the job's own steps and only when one of them failed. It sends one message: the repository, the branch, the commit, the job and a link to the run with its attempt number. By default it goes to your own inbox, as a note to self, and shows under Notes in the app. It carries nothing from the logs. Homing sends no push notification of its own; add a Telegram or Slack integration if you want a ping.

## What you need

A Homing account and a GitHub repository with Actions. The runner needs curl and jq; GitHub's hosted Ubuntu runners have both.

1. In the app, open Agent Mailboxes, choose New agent, name it ci (its handle is morpheus.ci, your handle and the name) and choose Create agent. Use an agent of its own for this: its key is the narrowest one Homing issues.
2. On the agent's page, under Key, choose Generate key. The key is shown once.
3. In the repository, open Settings, then Secrets and variables, then Actions. On the Secrets tab choose New repository secret, name it HOMING_KEY and paste the key.

## Add the step

Add the step at the end of the job it watches. if: failure() is true when an earlier step of the job failed; without it the step would be skipped, because a step gets a success() check by default. The values reach the script as environment variables, so a branch name is never part of the script text, and the key goes to curl through a config on its own descriptor, not the command line.

**.github/workflows/ci.yml**

```yaml
name: CI
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      # ... your own steps ...

      - name: Send the failure to Homing
        if: failure()
        env:
          HOMING_KEY: ${{ secrets.HOMING_KEY }}
          HOMING_TO: "" # empty: your own inbox. Or an agent of yours, such as morpheus.ci
          REPO: ${{ github.repository }}
          BRANCH: ${{ github.ref_name }}
          SHA: ${{ github.sha }}
          JOB: ${{ github.job }}
          RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
          ATTEMPT: ${{ github.run_attempt }}
        run: |
          [ -n "$HOMING_KEY" ] || { echo "No HOMING_KEY secret here; nothing sent."; exit 0; }
          h=$(printf 'ci-failure:%s:%s:%s:%s' "$REPO" "$RUN_URL" "$ATTEMPT" "$JOB" | sha1sum | cut -c1-32)
          id="${h:0:8}-${h:8:4}-5${h:13:3}-8${h:17:3}-${h:20:12}"
          jq -nc --arg id "$id" --arg to "$HOMING_TO" --arg subject "CI failed: $REPO ($BRANCH)" \
            --arg body "- Repository: $REPO
          - Branch: $BRANCH
          - Commit: $SHA
          - Job: $JOB
          - Run: $RUN_URL (attempt $ATTEMPT)" '
            {jsonrpc: "2.0", id: 1, method: "tools/call", params: {name: "send_message",
              arguments: ({message_id: $id, subject: $subject, message: $body, format: "markdown"}
                + (if $to == "" then {} else {to: $to} end))}}' |
            curl -sS -K <(printf 'header = "Authorization: Bearer %s"\n' "$HOMING_KEY") --connect-timeout 3 --max-time 10 \
              -w '\n%{http_code}\n' -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
              --data-binary @- https://api.tryhoming.com/mcp
```

## Choose the inbox

With HOMING_TO empty, the message goes to your own inbox as a note to self, marked as sent via the agent ci, and shows under Notes. It does not go to the agent's inbox. To send it to an agent inbox of yours instead, set HOMING_TO to that agent's handle: this key may send to its own agent, morpheus.ci, and to your other agents, without approval. A handle that is not yours or not in your directory is refused.

## What the key can do

The key sends as you, marked as sent via the agent ci, to your own inbox, to your agents and to the people and businesses in your contacts, within the send limits. It reads the inbox of the agent ci, and no other inbox: not another agent's, and not your own unless Let this agent read my inbox too is on for it. Leave that setting off for this agent. It cannot use the account tools, such as changing contacts, forms or integrations. Anyone who can push a workflow to the repository can read a repository secret, so make this key for this repository only. If the repository is ever compromised, revoke the key under Key on the agent's page, or under API keys, and generate a new one.

## One message per attempt

The message id comes from the repository, the run, the attempt and the job. A re-run of the workflow, or of only its failed jobs, keeps the run id and raises the attempt, so a failure in attempt 2 is a new attempt and so a second message, while the same attempt sent twice is one: Homing answers with the first receipt and "idempotent_replay":true. Each job that fails and has this step sends its own message. Several jobs sharing a job id, such as the legs of a matrix, send identical text and so one message.

## Check the reply

The step prints Homing's reply and an HTTP status in the run's log. A good reply holds "status":"delivered" and ends in 200. A 200 with "isError":true is a refusal, and the receipt says why. A 401 means the secret is wrong or the key was revoked. A failure in this step does not change the job's result, which has already failed. Make a job fail on purpose once to see it.

## When it sends nothing

A workflow triggered from a fork does not receive repository secrets, and one triggered by Dependabot receives only Dependabot secrets, not Actions secrets. HOMING_KEY is empty in both and the step prints a line and exits without sending. Nothing is retried.

## What the message carries

Only the five facts above, all from the GitHub context. Add more to the script only if you are willing to send it: a log line can hold a token or a customer's data. By default sends are limited to 30 a minute and 2,500 messages a month for the account, shared with everything else the account sends.
