-
Notifications
You must be signed in to change notification settings - Fork 2
168 lines (141 loc) · 6.47 KB
/
ai-targeted-fix.yml
File metadata and controls
168 lines (141 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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 }} --repo ${{ github.repository }} --body "$(cat <<'EOF'

# 🌀 領域展開・伏魔御厨子
## 영역전개 복마어주자
_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 }} --repo ${{ github.repository }} --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 }} --repo ${{ github.repository }} --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 }} --repo ${{ github.repository }} --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!)_ 🔪"