Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
59948c4
Add quick setup script for gh-aw
github-actions[bot] Feb 19, 2026
871288d
Update quick setup defaults and add continuous improvement option
github-actions[bot] Feb 19, 2026
81d35de
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 19, 2026
2e45295
Expand --continuous-improvement workflows, drop pr-ci-fixer (#180)
Copilot Feb 19, 2026
64218f3
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 20, 2026
c0c38f7
Add update-pr-body to quick-setup continuous improvement workflows (#…
Copilot Feb 20, 2026
2400cdb
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 20, 2026
0e1c127
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 20, 2026
894bf5b
Fix branch ordering, token handling, and README
strawgate Feb 21, 2026
d5cfcbc
Clarify that COPILOT_GITHUB_TOKEN requires a classic PAT
strawgate Feb 21, 2026
0da40c9
Use fine-grained PAT with copilot_requests permission
strawgate Feb 21, 2026
927e1b5
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 21, 2026
14c771a
Avoid exposing token in quick setup
github-actions[bot] Feb 21, 2026
e5b95e4
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 21, 2026
7422d55
Base setup branch on default branch
github-actions[bot] Feb 21, 2026
97b6473
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 21, 2026
e714a6e
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 21, 2026
8000a09
Hide token input in quick setup
github-actions[bot] Feb 21, 2026
bc2078c
Merge branch 'main' into issue-140-quick-setup-script-28dc95ff6ee078e5
strawgate Feb 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ Full documentation lives at https://elastic.github.io/ai-github-actions/.
- GitHub Agent Workflows provide safe-output guardrails with configurable engines (Copilot or Claude).
- Claude Composite Actions provide direct Claude Code actions with RO/RWX/RWXP permission variants.

## Quick setup script

Run from the repository you want to configure (requires `gh`, `git`, and `curl`):

````bash
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/scripts/quick-setup.sh \
| bash -s --
````

By default, this installs recommended GitHub Agent Workflow triggers, adds `agentics-maintenance.yml`,
sets `COPILOT_GITHUB_TOKEN`, creates branch `ai-gh-aw-setup`, pushes it, and opens a PR. Use
`--continuous-improvement` to also install selected continuous improvement workflows.

## License

MIT
35 changes: 35 additions & 0 deletions gh-agent-workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,38 @@ Full documentation and setup guides live in the docs site:
https://elastic.github.io/ai-github-actions/workflows/gh-agent-workflows/

Each workflow folder includes an `example.yml` trigger and a README covering inputs and safe outputs.

## Quick setup script

Run from the repository you want to configure:

````bash
curl -fsSL https://raw.githubusercontent.com/elastic/ai-github-actions/v0/scripts/quick-setup.sh \
| bash -s --
````

This installs a recommended set of triggers, adds `agentics-maintenance.yml`, sets
`COPILOT_GITHUB_TOKEN`, creates a setup branch, and opens a PR.

Default workflows:
- `pr-review`
- `issue-triage`
- `mention-in-issue`
- `mention-in-pr`
- `pr-ci-detective`

Use `--workflows` (comma-separated) to override the defaults, `--skip-secret` to set the
secret manually, `--continuous-improvement` to also install selected continuous improvement
workflows, or `--repo OWNER/REPO` when auto-detection is not available.

`--continuous-improvement` adds:
- `bug-hunter`
- `bug-exterminator`
- `code-simplifier`
- `docs-drift`
- `docs-new-contributor-review`
- `small-problem-fixer`
- `stale-issues`
- `test-improvement`
- `breaking-change-detect`
- `semantic-function-clustering`
Comment thread
github-actions[bot] marked this conversation as resolved.
248 changes: 248 additions & 0 deletions scripts/quick-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
#!/usr/bin/env bash
# Quick setup for GitHub Agent Workflows in a repository.
#
# Usage:
# ./scripts/quick-setup.sh [--repo OWNER/REPO] [--branch NAME]
# [--workflows "pr-review,issue-triage,..."]
# [--skip-secret] [--dry-run]

set -euo pipefail

branch="ai-gh-aw-setup"
repo=""
workflows_csv=""
skip_secret=false
continuous_improvement=false
dry_run=false

usage() {
cat <<'EOF'
Usage: quick-setup.sh [options]

Options:
--repo OWNER/REPO Repository to configure (defaults to current repo)
--branch NAME Branch name to create (default: ai-gh-aw-setup)
--workflows CSV Comma-separated workflow list (default: recommended set)
--skip-secret Skip setting COPILOT_GITHUB_TOKEN
--continuous-improvement
Add recommended continuous improvement workflows
--dry-run Print actions without making changes
-h, --help Show this help
EOF
}

while [ $# -gt 0 ]; do
case "$1" in
--repo)
repo="${2:-}"
shift 2
;;
--branch)
branch="${2:-}"
shift 2
;;
--workflows)
workflows_csv="${2:-}"
shift 2
;;
--skip-secret)
skip_secret=true
shift
;;
--continuous-improvement)
continuous_improvement=true
shift
;;
--dry-run)
dry_run=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown flag: $1" >&2
usage >&2
exit 1
;;
esac
done

require_cmd() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "Missing required command: $1" >&2
exit 1
fi
}

require_cmd gh
require_cmd git
require_cmd curl

repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [ -z "$repo_root" ]; then
echo "Run this script from inside a git repository." >&2
exit 1
fi
cd "$repo_root"

if [ -n "$(git status --porcelain)" ]; then
echo "Working tree has uncommitted changes. Commit or stash before running." >&2
exit 1
fi

if ! gh auth status -h github.com >/dev/null 2>&1; then
echo "GitHub CLI is not authenticated. Run 'gh auth login' first." >&2
exit 1
fi

if [ -z "$repo" ]; then
repo="$(gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || true)"
fi

if [ -z "$repo" ]; then
echo "Unable to determine repository. Use --repo OWNER/REPO." >&2
exit 1
fi

if [ -z "$branch" ]; then
echo "Branch name cannot be empty." >&2
exit 1
fi

base_url="https://raw.githubusercontent.com/elastic/ai-github-actions/v0"
default_workflows=(
pr-review
issue-triage
mention-in-issue
mention-in-pr
pr-ci-detective
)
continuous_improvement_workflows=(
bug-hunter
bug-exterminator
code-simplifier
docs-drift
docs-new-contributor-review
small-problem-fixer
stale-issues
test-improvement
breaking-change-detect
semantic-function-clustering
)

if [ -n "$workflows_csv" ]; then
workflows_csv="${workflows_csv// /}"
IFS=',' read -r -a workflows <<<"$workflows_csv"
else
workflows=("${default_workflows[@]}")
fi

append_workflow_if_missing() {
local candidate="$1"
local existing
for existing in "${workflows[@]}"; do
if [ "$existing" = "$candidate" ]; then
return
fi
done
workflows+=("$candidate")
}

if [ "$continuous_improvement" = true ]; then
for workflow in "${continuous_improvement_workflows[@]}"; do
append_workflow_if_missing "$workflow"
done
fi

if [ "${#workflows[@]}" -eq 0 ]; then
echo "Workflow list cannot be empty." >&2
exit 1
fi

workflow_dir=".github/workflows"
created_files=()

if [ "$dry_run" = true ]; then
echo "dry-run: mkdir -p $workflow_dir"
else
mkdir -p "$workflow_dir"
fi

for workflow in "${workflows[@]}"; do
[ -n "$workflow" ] || continue
src="$base_url/gh-agent-workflows/$workflow/example.yml"
dest="$workflow_dir/trigger-$workflow.yml"
if [ "$dry_run" = true ]; then
echo "dry-run: curl -fsSL $src -o $dest"
else
curl -fsSL "$src" -o "$dest"
created_files+=("$dest")
fi
done

maintenance_src="$base_url/.github/workflows/agentics-maintenance.yml"
maintenance_dest="$workflow_dir/agentics-maintenance.yml"
if [ "$dry_run" = true ]; then
echo "dry-run: curl -fsSL $maintenance_src -o $maintenance_dest"
else
curl -fsSL "$maintenance_src" -o "$maintenance_dest"
created_files+=("$maintenance_dest")
fi

if [ "$skip_secret" = false ]; then
token="${COPILOT_GITHUB_TOKEN:-}"
if [ -z "$token" ]; then
if [ "$dry_run" = true ]; then
echo "dry-run: gh auth refresh -h github.com -s copilot-requests"
echo "dry-run: gh auth token"
else
gh auth refresh -h github.com -s copilot-requests >/dev/null
token="$(gh auth token)"
fi
fi

if [ -z "$token" ] && [ "$dry_run" = false ]; then
echo "Unable to read token. Set COPILOT_GITHUB_TOKEN and rerun, or use --skip-secret." >&2
exit 1
fi

if [ "$dry_run" = true ]; then
echo "dry-run: gh secret set COPILOT_GITHUB_TOKEN --repo $repo --body (token)"
else
gh secret set COPILOT_GITHUB_TOKEN --repo "$repo" --body "$token"
Comment thread
github-actions[bot] marked this conversation as resolved.
Outdated
Comment thread
github-actions[bot] marked this conversation as resolved.
Outdated
fi
unset token
fi

if [ "$dry_run" = true ]; then
Comment thread
github-actions[bot] marked this conversation as resolved.
Outdated
echo "dry-run: git checkout -b $branch"
else
if git show-ref --verify --quiet "refs/heads/$branch"; then
git checkout "$branch"
else
git checkout -b "$branch"
fi
fi

if [ "$dry_run" = true ]; then
echo "dry-run: git add .github/workflows/trigger-*.yml .github/workflows/agentics-maintenance.yml"
echo "dry-run: git commit -m \"Add gh-aw workflows via quick setup\""
echo "dry-run: git push -u origin $branch"
echo "dry-run: gh pr create --repo $repo --fill"
exit 0
fi

git add "${created_files[@]}"

if git diff --cached --quiet; then
echo "No changes to commit."
exit 0
fi

git commit -m "Add gh-aw workflows via quick setup"
git push -u origin "$branch"
gh pr create --repo "$repo" --fill

echo "Installed workflows: ${workflows[*]}"
Loading