Skip to content
81 changes: 65 additions & 16 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,120 @@

# AI GitHub Actions

*40+ AI agents. Zero new tabs to monitor. Your repo (almost) runs itself.*
*Drop-in AI agents for GitHub repos. They triage issues, review PRs, diagnose CI failures, and continuously improve your codebase — all through standard GitHub Actions. Get started with our 5 core workflows with more than 40 additional workflows available to use as needed.*

---

## Get Started in 60 Seconds

**1. Create a Copilot PAT** (the link pre-fills name, description, and scope):
The agents use GitHub Copilot as their AI engine. You create a personal access token (PAT) so the workflows can authenticate.

**1. Create a Copilot PAT** — this link pre-fills the name, description, and scope:

[Create COPILOT_GITHUB_TOKEN →](https://github.com/settings/personal-access-tokens/new?name=COPILOT_GITHUB_TOKEN&description=GitHub+Agentic+Workflows+-+Copilot+engine+authentication&user_copilot_requests=read){ .md-button .md-button--primary }

Set the expiry to longer than the 30-day default (e.g., 90 days or 1 year).

**2. Store the secret and run the setup script** from the repository you want to configure (requires `gh`, `git`, and `curl`):
**2. Store the secret and install the core workflows** — `cd` into the repo you want to configure and run:

```bash
printf '%s' 'YOUR_PAT_HERE' | gh secret set COPILOT_GITHUB_TOKEN
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/scripts/quick-setup.sh \
| bash -s --

mkdir -p .github/workflows && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/issue-triage/example.yml \
-o .github/workflows/trigger-issue-triage.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/mention-in-issue/example.yml \
-o .github/workflows/trigger-mention-in-issue.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/mention-in-pr/example.yml \
-o .github/workflows/trigger-mention-in-pr.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/pr-review/example.yml \
-o .github/workflows/trigger-pr-review.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/pr-actions-detective/example.yml \
-o .github/workflows/trigger-pr-actions-detective.yml
```

This installs the core workflows, sets up `agentics-maintenance.yml`, creates a branch, and opens a PR. Use `--continuous-improvement` to also install codebase maintenance workflows.
**3. Commit and push.** That's it — you now have five agents working for you:

Or set up manually — see the [full setup docs](workflows/gh-agent-workflows.md).
- **New issues** are automatically triaged, labeled, and given an implementation plan.
- **Pull requests** get AI code reviews with severity-ranked inline comments.
- **Failed CI checks** are diagnosed with root-cause analysis and fix suggestions.
- **Type `/ai` in any issue or PR** to ask for help, get code written, or push fixes.

See the [full setup docs](workflows/gh-agent-workflows.md) for secrets, inputs, and customization options.

---

## Core Workflows

These four workflows are the foundation — install them first and you'll cover most day-to-day development needs:
These five workflows ship with the install command above:

| Workflow | Trigger | What it does |
| --- | --- | --- |
| **[Issue Triage](workflows/gh-agent-workflows/issue-triage.md)** | New issues | Investigate, label, and provide implementation plans |
| **[Mention in Issue](workflows/gh-agent-workflows/mention-in-issue.md)** | `/ai` in issues | Answer questions, debug, create PRs |
| **[Mention in PR](workflows/gh-agent-workflows/mention-in-pr.md)** | `/ai` in PRs | Review, fix code, push changes |
| **[PR Review](workflows/gh-agent-workflows/pr-review.md)** | PR opened / updated | AI code review with severity-ranked inline comments |
| **[PR Actions Detective](workflows/gh-agent-workflows/pr-actions-detective.md)** | Failed PR checks | Diagnose CI failures and recommend fixes |

---

## Repository Maintenance

Keep your issues and PRs clean and well-organized:
Add-on workflows that keep your issues and PRs clean:

| Workflow | What it does |
| --- | --- |
| [Duplicate Issue Detector](workflows/gh-agent-workflows/duplicate-issue-detector.md) | Flag duplicate issues with links to originals |
| [Stale Issues](workflows/gh-agent-workflows/stale-issues.md) | Find resolved issues and manage their lifecycle |
| [Update PR Body](workflows/gh-agent-workflows/update-pr-body.md) | Auto-populate PR descriptions from diffs and linked issues |
| [PR Actions Detective](workflows/gh-agent-workflows/pr-actions-detective.md) | Diagnose CI failures and recommend fixes |

??? tip "Install these workflows"

`cd` into your repo and run:

```bash
mkdir -p .github/workflows && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/duplicate-issue-detector/example.yml \
-o .github/workflows/trigger-duplicate-issue-detector.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-investigator/example.yml \
-o .github/workflows/trigger-stale-issues-investigator.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/update-pr-body/example.yml \
-o .github/workflows/trigger-update-pr-body.yml
```

---

## Codebase Maintenance

Scheduled agents that continuously improve your codebase:
Scheduled agents that continuously find and fix problems:

| Workflow | What it does |
| --- | --- |
| [Bug Hunting](workflows/gh-agent-workflows/bugs.md) | Find and fix reproducible bugs |
| [Code Duplication](workflows/gh-agent-workflows/code-duplication.md) | Detect and consolidate duplicate code |
| [Bug Hunting](workflows/gh-agent-workflows/bugs.md) | Find reproducible bugs and open PRs to fix them |
| [Code Duplication](workflows/gh-agent-workflows/code-duplication.md) | Detect duplicate code and consolidate it |
| [Test Coverage](workflows/gh-agent-workflows/test-coverage.md) | Find coverage gaps and add targeted tests |
| [Code Simplifier](workflows/gh-agent-workflows/code-simplifier.md) | Simplify overcomplicated code with high-confidence refactors |
| [Docs Patrol](workflows/gh-agent-workflows/docs-patrol-overview.md) | Catch stale documentation |

[Browse all workflows →](workflows/gh-agent-workflows.md){ .md-button }
| [Docs Patrol](workflows/gh-agent-workflows/docs-patrol-overview.md) | Catch stale documentation and flag it |

??? tip "Install these workflows"

`cd` into your repo and run:

```bash
mkdir -p .github/workflows && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-hunter/example.yml \
-o .github/workflows/trigger-bug-hunter.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-detector/example.yml \
-o .github/workflows/trigger-code-duplication-detector.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-coverage-detector/example.yml \
-o .github/workflows/trigger-test-coverage-detector.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-simplifier/example.yml \
-o .github/workflows/trigger-code-simplifier.yml && \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/docs-patrol/example.yml \
-o .github/workflows/trigger-docs-patrol.yml
```

[Browse all 40+ workflows →](workflows/gh-agent-workflows.md){ .md-button }

---

Expand Down
30 changes: 30 additions & 0 deletions docs/workflows/detector-fixer-chaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,35 @@ jobs:

This pattern gives you: **Audit creates issue -> same workflow: if issue was created, then start `create-pr-from-issue`**.

## Detector creates issue -> assign to Copilot

Instead of chaining to a fixer workflow, you can assign the created issue to GitHub's Copilot coding agent and let it open a PR. This is useful when you don't have a dedicated fixer workflow or want to use Copilot's native implementation flow.

```yaml
jobs:
detect:
uses: elastic/ai-github-actions/.github/workflows/gh-aw-bug-hunter.lock.yml@v0
secrets:
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}

assign-to-copilot:
needs: detect
if: needs.detect.outputs.created_issue_number != ''
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Assign issue to Copilot
env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue edit ${{ needs.detect.outputs.created_issue_number }} \
--repo ${{ github.repository }} \
--add-assignee @copilot
```

Copilot picks up the assignment, reads the issue, and opens a PR — using its own session and context window. No `COPILOT_GITHUB_TOKEN` is needed for the handoff job itself since assignment only requires `issues: write`.

## Complete examples

### Bug Hunter + Bug Exterminator
Expand Down Expand Up @@ -141,6 +170,7 @@ jobs:
| Approach | Best for |
|---|---|
| **Chained** (single run) | Fully autonomous loops where you want immediate action on findings |
| **Assign to Copilot** | Lightweight handoff — detector creates the issue, Copilot implements it natively |
| **Separate schedules** | Human-in-the-loop review — run the detector, review its issues, then let the fixer run later |
| **Detector only** | When you only want reports, not automatic fixes |

Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Each workflow directory contains an `example.yml` starter and a README for trigg

## Recommended workflow sets

The quick setup script includes two opinionated sets:
The [quick setup script](https://github.com/elastic/ai-github-actions/blob/main/scripts/quick-setup.sh) bundles two opinionated sets. The [homepage](../index.md) shows how to install the core workflows with a single copy-paste command.

- **Starter repo operations set (default):** `pr-review`, `issue-triage`, `mention-in-issue`, `mention-in-pr`, `pr-actions-detective`
- **Core (default):** `pr-review`, `issue-triage`, `mention-in-issue`, `mention-in-pr`, `pr-actions-detective`
- **Continuous improvement add-ons (`--continuous-improvement`):** `bug-hunter`, `bug-exterminator`, `code-simplifier`, `docs-patrol`, `newbie-contributor-patrol`, `small-problem-fixer`, `stale-issues-investigator`, `stale-issues-remediator`, `test-coverage-detector`, `test-improver`, `breaking-change-detector`, `code-duplication-detector`, `update-pr-body`

## Available workflows
Expand Down Expand Up @@ -148,7 +148,7 @@ Some workflows require additional provider-specific secrets (for example, `PR Bu
Any workflow that uses safe-outputs with `expires` (create-issue, create-pull-request, create-discussion) requires the `agentics-maintenance` workflow so expired items are closed automatically. Install it once per repo:

````bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/.github/workflows/agentics-maintenance.yml \
-o .github/workflows/agentics-maintenance.yml
````
Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows/bugs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Find reproducible bugs and automatically fix them.
Install Bug Hunter alone if you want to review bug reports before acting on them.

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-hunter/example.yml \
-o .github/workflows/bug-hunter.yml
```
Expand All @@ -22,9 +22,9 @@ Install both for a fully autonomous bug-finding and fixing pipeline.

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-hunter/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-hunter/example.yml \
-o .github/workflows/bug-hunter.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-exterminator/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-exterminator/example.yml \
-o .github/workflows/bug-exterminator.yml
```

Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows/code-duplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Find duplicate and misplaced functions, then consolidate them automatically.
Install the detector alone if you want to review refactoring recommendations before acting.

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-detector/example.yml \
-o .github/workflows/code-duplication-detector.yml
```
Expand All @@ -22,9 +22,9 @@ Install both for autonomous detection and consolidation.

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-detector/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-detector/example.yml \
-o .github/workflows/code-duplication-detector.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-fixer/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-duplication-fixer/example.yml \
-o .github/workflows/code-duplication-fixer.yml
```

Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows/docs-patrol-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Two variants cover different documentation scopes: **Docs Patrol** checks intern
### Internal docs only

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/docs-patrol/example.yml \
-o .github/workflows/docs-patrol.yml
```
Expand All @@ -18,9 +18,9 @@ mkdir -p .github/workflows && curl -sL \

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/docs-patrol/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/docs-patrol/example.yml \
-o .github/workflows/docs-patrol.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/estc-docs-patrol-external/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/estc-docs-patrol-external/example.yml \
-o .github/workflows/estc-docs-patrol-external.yml
```

Expand Down
12 changes: 6 additions & 6 deletions docs/workflows/gh-agent-workflows/newbie-contributor.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Review documentation from a new contributor's perspective and automatically fix
### Patrol only (human reviews issues)

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-patrol/example.yml \
-o .github/workflows/newbie-contributor-patrol.yml
```
Expand All @@ -18,21 +18,21 @@ mkdir -p .github/workflows && curl -sL \

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-patrol/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-patrol/example.yml \
-o .github/workflows/newbie-contributor-patrol.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-fixer/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-fixer/example.yml \
-o .github/workflows/newbie-contributor-fixer.yml
```

### All three (patrol + external + fixer)

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-patrol/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-patrol/example.yml \
-o .github/workflows/newbie-contributor-patrol.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/estc-newbie-contributor-patrol-external/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/estc-newbie-contributor-patrol-external/example.yml \
-o .github/workflows/estc-newbie-contributor-patrol-external.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-fixer/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/newbie-contributor-fixer/example.yml \
-o .github/workflows/newbie-contributor-fixer.yml
```

Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows/stale-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Find resolved issues, label them as stale, and automatically close them after a
Install the investigator alone if you want to review stale-issue reports and handle closure manually.

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-investigator/example.yml \
-o .github/workflows/stale-issues-investigator.yml
```
Expand All @@ -22,9 +22,9 @@ Install both for a fully autonomous stale-issue lifecycle.

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-investigator/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-investigator/example.yml \
-o .github/workflows/stale-issues-investigator.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-remediator/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/stale-issues-remediator/example.yml \
-o .github/workflows/stale-issues-remediator.yml
```

Expand Down
6 changes: 3 additions & 3 deletions docs/workflows/gh-agent-workflows/test-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Find under-tested code and automatically add focused tests.
Install the detector alone if you want to review test coverage reports before acting.

```bash
mkdir -p .github/workflows && curl -sL \
mkdir -p .github/workflows && curl -fsSL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-coverage-detector/example.yml \
-o .github/workflows/test-coverage-detector.yml
```
Expand All @@ -22,9 +22,9 @@ Install both for autonomous detection and test improvement.

```bash
mkdir -p .github/workflows && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-coverage-detector/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-coverage-detector/example.yml \
-o .github/workflows/test-coverage-detector.yml && \
curl -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-improver/example.yml \
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/test-improver/example.yml \
-o .github/workflows/test-improver.yml
```

Expand Down
Loading
Loading