---
title: "Turn GitHub Issues and CI Failures Into Tasks | AgentRQ Guidelines"
url: https://agentrq.com/guidelines/hooks/turn-github-issues-and-ci-failures-into-agent-tasks
description: "Give your AI coding agent a task when a GitHub issue opens or CI fails: create an event and trigger, register the github hook, add the webhook in GitHub."
---

![](https://agentrq.com/assets/guideline-icons/github.svg) Checked November 26, 2026 | [All Hooks guides](https://agentrq.com/guidelines/hooks/)

# Turn GitHub Issues and CI Failures Into Tasks

To give an agent a task whenever something happens in a GitHub repository, create an event with a trigger that files the task, register the built-in **github** hook and route the GitHub event to yours, then add the hook's payload URL and secret as a webhook in the repository. This guide sets it up for new issues. The same steps work for failed CI runs, pull requests, releases and pushes.

This page is one of our [Hooks guidelines](https://agentrq.com/guidelines/hooks/). It follows the [Hooks docs](https://github.com/agentrq/agentrq/blob/main/docs/HOOKS.md) and was checked against AgentRQ v0.19.6 on November 26, 2026.

## What the github Hook Can Fire

The hook checks GitHub's **X-Hub-Signature-256** signature against your webhook secret, then fires one of these events. Tick the matching GitHub event when you add the webhook.

| Hook event | When | GitHub webhook event to tick |
| --- | --- | --- |
| issue.opened | An issue was opened | Issues |
| pr.opened | A pull request was opened | Pull requests |
| pr.review_requested | A review was requested on a pull request | Pull requests |
| ci.failed | A GitHub Actions workflow run finished with failure or timed out | Workflow runs |
| ci.succeeded | A GitHub Actions workflow run finished with success | Workflow runs |
| release.published | A release was published | Releases |
| push | Commits were pushed to a branch | Pushes |

## Before You Start

- → A workspace whose agent knows the repository's code, here **storefront-api**, with an agent connected.
- → Admin access to the GitHub repository, to add a webhook.
- → A server GitHub can reach. On agentrq.com it can. Self-hosted, see [make the payload URL reachable](https://agentrq.com/guidelines/hooks/check-hook-deliveries-replay-rotate-and-reach-your-server#make-the-payload-url-reachable).

## Step 1: Create the Event

An event fires the tasks its triggers describe, so set it up first. Open **Events** in the sidebar.

**1. Click + New Event.**

**2. Name it** `github_issue_opened`. Event names are yours: pick one that says what happened.

**3. Click Create event.**

![Steps 1 to 3: the New Event form, with the name github_issue_opened](https://agentrq.com/assets/guidelines/hooks-github-1-new-event.png)

## Step 2: Add a Trigger to It

A trigger says which workspace gets the task and what the task says. On the event's page:

**1. Click + Add trigger.**

![Step 1: the event's page, with the + Add trigger button](https://agentrq.com/assets/guidelines/hooks-github-2-add-trigger.png)

**2. Pick the workspace** that gets the task, here **storefront-api**.

**3. Write a task title**, such as "Triage the new GitHub issue". Every task gets this title word for word: the issue's own title is in the details.

**4. Click + Event payload.** It puts `{{EVENT_PAYLOAD}}` in the instructions, which becomes the issue's title, body and link when the task is made. Write what the agent should do around it, such as "Read the issue below, label it and reply with a first answer."

**5. Click Create trigger.** Leave **Who works on it** on **Agent**, and **YOLO mode** off unless you trust every request this hook will get.

![Steps 2 to 5: the New Trigger form, with the workspace agentrq-backend, the title Triage the new GitHub issue, the Event payload button and Create trigger](https://agentrq.com/assets/guidelines/hooks-github-3-trigger.png)

## Step 3: Register the github Hook

Open **Events → Hooks** and click **New registration**.

**1. Name the registration**, such as the repository's name. GitHub never sees it.

**2. Pick the github hook.**

**3. Click Generate** to make a random webhook secret.

**4. Click Copy.** GitHub needs the secret, and AgentRQ stores it encrypted and never shows it again.

**5. Route issue.opened to github_issue_opened.** Leave the other events **Not routed**.

**6. Click Create registration.**

**Branches** takes globs such as `main` or `release/*`. It limits CI runs, pull requests and pushes to matching branches; left empty, every branch counts. A `*` does not cross a `/`, so `release/*` matches `release/1.2` but not `release/1.2/hotfix`.

![Steps 1 to 6: the New registration form, with the name, the github hook, the Generate and Copy buttons for the webhook secret, issue.opened routed to github_issue_opened, and Create registration](https://agentrq.com/assets/guidelines/hooks-github-4-registration.png)

**7. Click Copy URL.** The page now shows the registration's **payload URL**. It ends in `?agentrq_hook_token=…`, and this is the only time the full URL is shown. Copy all of it, token included. If you lose it, [rotate the token](https://agentrq.com/guidelines/hooks/check-hook-deliveries-replay-rotate-and-reach-your-server) for a new one.

![Step 7: the registration's payload URL, with the Copy URL button](https://agentrq.com/assets/guidelines/hooks-github-5-payload-url.png)

## Step 4: Add the Webhook in GitHub

In the repository, open **Settings → Webhooks → Add webhook**.

**1. Payload URL:** the URL you copied, with its `agentrq_hook_token`.

**2. Content type:** `application/json`. GitHub's default, `application/x-www-form-urlencoded`, is rejected.

**3. Secret:** the webhook secret from step 3. It is not the hook token.

**4. Choose Let me select individual events.**

![Steps 1 to 4: GitHub's Add webhook form, with the payload URL, application/json and the secret](https://agentrq.com/assets/guidelines/hooks-github-6-webhook.png)

**5. Tick the GitHub event for each route:** **Issues** here. Use the table above for the others.

![Step 5: GitHub's event list with Issues ticked](https://agentrq.com/assets/guidelines/hooks-github-7-events.png)

**6. Click Add webhook.**

![Step 6: the Add webhook button](https://agentrq.com/assets/guidelines/hooks-github-8-add-webhook.png)

## Try It

Open an issue in the repository. Within a few seconds a task titled "Triage the new GitHub issue" appears under **Not started** in **storefront-api**, with the issue in its instructions, and the agent picks it up.

GitHub also sends a **ping** when you add the webhook. It shows up as **ignored** in the registration's **Deliveries**, because no event is routed for it. That is expected, and it proves GitHub can reach your server. If no task appears for the issue, read [check hook deliveries](https://agentrq.com/guidelines/hooks/check-hook-deliveries-replay-rotate-and-reach-your-server): a **rejected** delivery names the reason, such as a secret that does not match.

## More Things to Route

- → **ci.failed → a "fix the build" task.** Point the trigger at the workspace that owns the pipeline, and add **Branches** `main` so only failures on main start work.
- → **pr.review_requested → a review task.** The agent reviews the pull request and replies, and you decide whether to merge.
- → **release.published → a release-notes task** in a docs workspace.

One registration can route several events, each to a different event of yours, and each event can have triggers in several workspaces. The [Dependabot alerts post](https://agentrq.com/blog/dependabot-alerts-wake-claude-code-agent-with-agentrq-hooks) shows three more ways to wire GitHub to an agent.

## FAQ

### Is the webhook secret the same as the hook token?

No. The secret is what GitHub signs each request with, and the hook checks the signature. The token is the `agentrq_hook_token` part of the URL, which tells AgentRQ which registration the request is for. GitHub needs both: the token inside the URL, the secret in the Secret field.

### Can one registration serve several repositories?

Yes. Add the same payload URL and secret as a webhook in each repository, or once as an organization webhook. The task's details name the repository.

### Why did a retry not create a second task?

GitHub sends each delivery with an id, and the hook uses it to drop repeats. A redelivery shows up as **duplicate** in **Deliveries** and fires nothing.

### Can the agent comment on the issue?

The hook only reads from GitHub. For the agent to comment, label or open a pull request, give the workspace access to GitHub, such as the GitHub CLI or the GitHub MCP server, and say so in the trigger's instructions.
