ci: add Claude Assistant and PR @claude triggers for PraisonAIUI

Wire issue_comment to claude-code-action with correct checkout for both
standalone issues and PR threads, and add auto PR @claude comments.
This commit is contained in:
MervinPraison committed 2026-04-17 13:20:24 +01:00
1 parent 206109086b
commit 9dedf9cbbd
2 files changed
+106

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
name: Auto PR Comment
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
trigger-claude:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Check whether Claude already triggered
id: check_claude
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const issue_number = context.issue.number;
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number,
per_page: 100
});
const already = comments.some((c) =>
c.user?.login === 'github-actions[bot]' &&
(c.body || '').includes('@claude')
);
core.setOutput('already_triggered', already ? 'true' : 'false');
- name: Post Claude trigger prompt
if: steps.check_claude.outputs.already_triggered != 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = `@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAIUI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on PraisonAIUI package and docs (src/praisonaiui, tests, docs). Read ALL comments above from reviewers carefully before responding.
**Phase 1: Review per AGENTS.md**
1. Keep changes minimal and focused
2. Backward compatible: ensure zero feature regressions
3. Performance: no hot-path regressions
**Phase 2: FIX Valid Issues**
4. For any VALID bugs or architectural flaws found by reviewers: implement the fix
5. Push all code fixes directly to THIS branch (do NOT create a new PR)
6. Comment a summary of exact files modified and what you skipped
**Phase 3: Final Verdict**
7. If all issues are resolved, approve the PR / close linked issue
8. If blocking issues remain, clearly list blockers with exact file paths`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
+38
View File
@@ -0,0 +1,38 @@
name: Claude Assistant
on:
issue_comment:
types: [created]
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
claude-response:
if: |
github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '@claude') &&
github.actor != 'dependabot[bot]' &&
github.actor != 'cursor[bot]' &&
github.actor != 'renovate[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.issue.pull_request && format('refs/pull/{0}/head', github.event.issue.number) || github.event.repository.default_branch }}
- name: Run Claude Code Action
uses: anthropics/claude-code-action@beta
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
trigger_phrase: "@claude"
allowed_bots: "praisonai-triage-agent[bot]"
timeout_minutes: "30"