Skip to content

AI Targeted Fixer

AI Targeted Fixer #94

name: 🌀 Ryoiki Tenkai - Domain Expansion
on:
issue_comment:
types: [created]
check_suite:
types: [completed]
jobs:
domain-expansion:
if: |
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.login != 'github-actions[bot]' &&
contains(github.event.comment.body, '@ryoiki-tenkai')) ||
(github.event_name == 'check_suite' &&
github.event.check_suite.app.name == 'coderabbitai' &&
github.event.check_suite.conclusion == 'success')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: 🌀 Post Domain Expansion Reply
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "$(cat <<'EOF'
![Ryomen Sukuna Domain Expansion](https://i.namu.wiki/i/WqnbGcgB_rsA6Y2jMVDPVnZmpXBuYmwkOSQNYipWHMcoAfOtglGFOAxL2sniyCD1RosOgacCUse0sQsffsBJSQ.gif)
# 🌀 領域展開・伏魔御厨子
## 영역전개 복마어주자
_Ryōiki Tenkai: Fukuma Mizushi_
---
**Initiating automated code fixes...**
Aider + DeepSeek will now resolve all CodeRabbit review comments.
Maximum iterations: **3**
Current status: **Processing** 🔄
EOF
)"
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.event.check_suite.pull_requests[0].head.ref }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Get PR Number
id: pr
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]; then
echo "number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
else
echo "number=${{ github.event.check_suite.pull_requests[0].number }}" >> $GITHUB_OUTPUT
fi
- name: 🛡️ Check Iteration Count
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_BODY=$(gh pr view ${{ steps.pr.outputs.number }} --json body -q '.body')
ITERATION=$(echo "$PR_BODY" | grep -oP '<!-- ai-fix-count: \K\d+' || echo 0)
if [ $ITERATION -ge 3 ]; then
echo "::notice::🛑 Maximum 3 iterations reached. Domain collapsed."
gh pr comment ${{ steps.pr.outputs.number }} --body "🛑 **Domain Expansion Complete**\n\nMaximum iterations (3) reached. Manual review required for remaining issues."
exit 0
fi
echo "ITERATION=$ITERATION" >> $GITHUB_ENV
echo "::notice::🌀 Iteration: $((ITERATION + 1))/3"
- name: 📊 Check Unresolved Comments
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
UNRESOLVED=$(gh pr view ${{ steps.pr.outputs.number }} --json comments --jq '[.comments[] | select(.author.login == "coderabbitai")] | length')
if [ $UNRESOLVED -eq 0 ]; then
echo "::notice::✅ All CodeRabbit comments resolved!"
gh pr comment ${{ steps.pr.outputs.number }} --body "✅ **Domain Expansion: Success**\n\n全ての問題を解決しました!(All issues resolved!)\n\n🎉 Code review complete."
exit 0
fi
echo "Found $UNRESOLVED CodeRabbit comments to process"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-aider
- name: Install Tools
run: pip install aider-chat
- name: Extract All Reviews
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr view ${{ steps.pr.outputs.number }} --comments > reviews.txt
if [ ! -s reviews.txt ]; then
echo "No reviews found. Exiting."
exit 0
fi
- name: 🌀 Execute Domain Expansion
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
run: |
{
echo "# 🌀 領域展開・伏魔御厨子 (Domain Expansion: Malevolent Shrine)"
echo ""
echo "## Review comments (fix these issues):"
echo ""
cat reviews.txt
echo ""
echo "## Instructions"
echo "- Fix every issue mentioned above."
echo ""
echo "## Commit Guidelines (IMPORTANT)"
echo "- Make SMALL, ATOMIC commits for each logical change (break into multiple commits)"
echo "- Use conventional commit format: <type>: <description in Korean>"
echo "- Types (in English): feat, fix, refactor, docs, style, test, chore"
echo "- Description (in Korean): Clear explanation of what was changed"
echo "- Examples:"
echo " - feat: 사용자 인증 로직 추가"
echo " - fix: 로그인 버그 수정"
echo " - refactor: 컴포넌트 구조 개선"
} > strategy.md
aider --model deepseek/deepseek-chat --message-file strategy.md --yes --no-check-update
- name: 📈 Update Iteration Counter
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_BODY=$(gh pr view ${{ steps.pr.outputs.number }} --json body -q '.body')
# Add or update iteration counter
if echo "$PR_BODY" | grep -q "<!-- ai-fix-count:"; then
NEW_BODY=$(echo "$PR_BODY" | sed "s/<!-- ai-fix-count: [0-9]* -->/<!-- ai-fix-count: $((ITERATION + 1)) -->/")
else
NEW_BODY="$PR_BODY\n\n<!-- ai-fix-count: $((ITERATION + 1)) -->"
fi
echo "$NEW_BODY" | gh pr edit ${{ steps.pr.outputs.number }} --body-file -
- name: 🚀 Push Changes
run: |
git push origin HEAD || echo "Nothing to push"
- name: 🎯 Post Progress Update
if: success()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ steps.pr.outputs.number }} --body "⚡ **Domain Expansion: Wave $((ITERATION + 1))/3 Complete**\n\nChanges have been pushed. CodeRabbit will now review the fixes...\n\n_斬撃が降り注ぐ!(The slashes rain down!)_ 🔪"