Mention in PR¶
AI assistant for PRs — review, fix code, and push changes on demand.
Workflow source: gh-aw-mention-in-pr.md
How it works¶
Activated by a comment on a pull request or inline review thread (the example trigger uses /ai, but the prefix is configurable). Reads the PR diff and codebase, then reviews code, answers questions, pushes fixes to the PR branch, or resolves review threads.
Quick Install¶
mkdir -p .github/workflows && curl -sL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/mention-in-pr/example.yml \
-o .github/workflows/mention-in-pr.yml
Trigger¶
| Event | Types | Condition |
|---|---|---|
issue_comment |
created |
Comment on a PR; the example trigger filters on /ai prefix |
pull_request_review_comment |
created |
Inline review comment; the example trigger filters on /ai prefix |
Inputs¶
| Input | Description | Required | Default |
|---|---|---|---|
additional-instructions |
Repo-specific instructions appended to the agent prompt | No | "" |
setup-commands |
Shell commands run before the agent starts | No | "" |
allowed-bot-users |
Allowed bot actor usernames (comma-separated); also GH-AW trusted-users under min-integrity approved | No | github-actions[bot] |
report-failure-as-issue |
When true, agent failures are reported as a GitHub issue |
No | true |
github-token-policy |
Elastic-specific. Backstage TokenPolicy id for elastic/oblt-actions/github/create-token. When set, mint an OIDC ephemeral GitHub token in each token-consuming job so comments, reviews, and pushes re-trigger downstream workflows (and can satisfy CODEOWNERS when the Vault app is listed). Requires Elastic TokenPolicy / ephemeral-token infrastructure; leave empty outside Elastic. The caller job must grant id-token: write. |
No | "" |
Secrets¶
| Secret | Description | Required |
|---|---|---|
GH_AW_GITHUB_TOKEN |
Optional override token for GitHub API writes. Prefer github-token-policy with OIDC when available. When neither is set, GITHUB_TOKEN is used. |
No |
Safe Outputs¶
add-comment— reply to the PR conversationcreate-pull-request-review-comment— inline review commentssubmit-pull-request-review— submit a reviewpush-to-pull-request-branch— push code changes to the PR branchresolve-pull-request-review-thread— resolve review threads
Example Workflow¶
name: Mention in PR
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
permissions:
actions: read
contents: write
copilot-requests: write
discussions: write
issues: write
pull-requests: write
id-token: write
jobs:
run:
if: >-
startsWith(github.event.comment.body, '/ai') &&
(github.event.issue.pull_request != null || github.event_name == 'pull_request_review_comment')
uses: elastic/ai-github-actions/.github/workflows/gh-aw-mention-in-pr.lock.yml@v0
# with:
# Elastic-specific (OIDC): mint an ephemeral token inside the lock workflow so
# comments and reviews re-trigger downstream workflows. Requires Elastic
# TokenPolicy / ephemeral-token infrastructure and id-token: write on this job.
# Leave unset outside Elastic.
# github-token-policy: "<shared-token-policy-id>"