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 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 -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/issue-triage/example.yml \
-o .github/workflows/trigger-issue-triage.yml && \
curl -sL 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 -sL 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 -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/pr-review/example.yml \
-o .github/workflows/trigger-pr-review.yml && \
curl -sL 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 -sL 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 -sL 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 -sL 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 -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/bug-hunter/example.yml \
-o .github/workflows/trigger-bug-hunter.yml && \
curl -sL 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 -sL 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 -sL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/code-simplifier/example.yml \
-o .github/workflows/trigger-code-simplifier.yml && \
curl -sL 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
29 changes: 29 additions & 0 deletions docs/workflows/detector-fixer-chaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,34 @@ 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 api repos/${{ github.repository }}/issues/${{ needs.detect.outputs.created_issue_number }}/assignees \
--method POST --field "assignees[]=copilot"
```

Copilot will pick up the assignment, read the issue, and open 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 +169,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
4 changes: 2 additions & 2 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
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ nav:
- Release: release.md
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- attr_list
- md_in_html
- toc:
Expand Down
Loading