Skip to content

Commit 08e612c

Browse files
committed
fix(ci): adapt PR review workflow for local fork
- Replace bot-setup action with inline Opencode LLM Proxy config - Update BOT_NAMES_JSON from mirrobot variants to github-actions[bot] - Change trigger command from /mirrobot-review to /ai-review - Replace all steps.setup.outputs.token with secrets.GH_PAT - Uses existing LLM_PROXY_* secrets for AI code review
1 parent 66692ab commit 08e612c

1 file changed

Lines changed: 46 additions & 24 deletions

File tree

.github/workflows/pr-review.yml

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ jobs:
2727
(
2828
github.event_name == 'issue_comment' &&
2929
github.event.issue.pull_request &&
30-
github.event.comment.user.login != 'mirrobot' &&
31-
github.event.comment.user.login != 'mirrobot-agent' &&
32-
github.event.comment.user.login != 'mirrobot-agent[bot]' &&
33-
(contains(github.event.comment.body, '/mirrobot-review') || contains(github.event.comment.body, '/mirrobot_review'))
30+
github.event.comment.user.login != 'github-actions[bot]' &&
31+
(contains(github.event.comment.body, '/ai-review') || contains(github.event.comment.body, '/ai_review'))
3432
)
3533
runs-on: ubuntu-latest
3634
permissions:
@@ -39,7 +37,7 @@ jobs:
3937

4038
env:
4139
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number || inputs.prNumber }}
42-
BOT_NAMES_JSON: '["mirrobot", "mirrobot-agent", "mirrobot-agent[bot]"]'
40+
BOT_NAMES_JSON: '["github-actions[bot]"]'
4341
IGNORE_BOT_NAMES_JSON: '["ellipsis-dev"]'
4442
COMMENT_FETCH_LIMIT: '20'
4543
REVIEW_FETCH_LIMIT: '30'
@@ -84,8 +82,8 @@ jobs:
8482
echo "---"
8583
8684
# Check for trigger words in clean text
87-
# Trigger: /mirrobot-review or /mirrobot_review
88-
if echo "$CLEAN_BODY" | grep -qE '/mirrobot[-_]review'; then
85+
# Trigger: /ai-review or /ai_review
86+
if echo "$CLEAN_BODY" | grep -qE '/ai[-_]review'; then
8987
echo "::notice::Valid trigger found in non-quoted, non-code text."
9088
echo "should_proceed=true" >> $GITHUB_OUTPUT
9189
else
@@ -96,23 +94,47 @@ jobs:
9694
- name: Checkout repository
9795
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
9896
uses: actions/checkout@v4
97+
with:
98+
token: ${{ secrets.GH_PAT }}
9999

100-
- name: Bot Setup
100+
- name: Configure Git
101101
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
102-
id: setup
103-
uses: ./.github/actions/bot-setup
104-
with:
105-
bot-app-id: ${{ secrets.BOT_APP_ID }}
106-
bot-private-key: ${{ secrets.BOT_PRIVATE_KEY }}
107-
opencode-api-key: ${{ secrets.OPENCODE_API_KEY }}
108-
opencode-model: ${{ secrets.OPENCODE_MODEL }}
109-
opencode-fast-model: ${{ secrets.OPENCODE_FAST_MODEL }}
110-
custom-providers-json: ${{ secrets.CUSTOM_PROVIDERS_JSON }}
102+
run: |
103+
git config user.name "github-actions[bot]"
104+
git config user.email "github-actions[bot]@users.noreply.github.com"
105+
106+
- name: Install Opencode
107+
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
108+
run: curl -fsSL https://opencode.ai/install | bash
109+
110+
- name: Configure Opencode for LLM Proxy
111+
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
112+
env:
113+
LLM_PROXY_URL: ${{ secrets.LLM_PROXY_URL }}
114+
LLM_PROXY_API_KEY: ${{ secrets.LLM_PROXY_API_KEY }}
115+
LLM_PROXY_MODEL: ${{ secrets.LLM_PROXY_MODEL }}
116+
run: |
117+
mkdir -p ~/.config/opencode
118+
DOLLAR='$'
119+
MODEL="${LLM_PROXY_MODEL:-nano_gpt/zai-org/glm-4.7}"
120+
cat > ~/.config/opencode/opencode.json <<EOFCFG
121+
{
122+
"${DOLLAR}schema": "https://opencode.ai/config.json",
123+
"provider": {
124+
"llm-proxy": {
125+
"api": "openai",
126+
"models": { "$MODEL": {} },
127+
"options": { "apiKey": "$LLM_PROXY_API_KEY", "baseURL": "$LLM_PROXY_URL" }
128+
}
129+
},
130+
"model": "llm-proxy/$MODEL"
131+
}
132+
EOFCFG
111133
112134
- name: Clear pending bot review
113135
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
114136
env:
115-
GH_TOKEN: ${{ steps.setup.outputs.token }}
137+
GH_TOKEN: ${{ secrets.GH_PAT }}
116138
BOT_NAMES_JSON: ${{ env.BOT_NAMES_JSON }}
117139
run: |
118140
pending_review_ids=$(gh api --paginate \
@@ -140,7 +162,7 @@ jobs:
140162
- name: Add reaction to PR
141163
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
142164
env:
143-
GH_TOKEN: ${{ steps.setup.outputs.token }}
165+
GH_TOKEN: ${{ secrets.GH_PAT }}
144166
BOT_NAMES_JSON: ${{ env.BOT_NAMES_JSON }}
145167
IGNORE_BOT_NAMES_JSON: ${{ env.IGNORE_BOT_NAMES_JSON }}
146168
run: |
@@ -154,7 +176,7 @@ jobs:
154176
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
155177
id: pr_meta
156178
env:
157-
GH_TOKEN: ${{ steps.setup.outputs.token }}
179+
GH_TOKEN: ${{ secrets.GH_PAT }}
158180
run: |
159181
# Fetch core PR metadata (comments and reviews fetched via GraphQL below)
160182
pr_json=$(gh pr view ${{ env.PR_NUMBER }} --repo ${{ github.repository }} --json author,title,body,createdAt,state,headRefName,baseRefName,headRefOid,additions,deletions,commits,files,closingIssuesReferences,headRepository)
@@ -445,7 +467,7 @@ jobs:
445467
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
446468
id: review_type
447469
env:
448-
GH_TOKEN: ${{ steps.setup.outputs.token }}
470+
GH_TOKEN: ${{ secrets.GH_PAT }}
449471
BOT_NAMES_JSON: ${{ env.BOT_NAMES_JSON }}
450472
run: |
451473
# Robust last summary detection:
@@ -527,7 +549,7 @@ jobs:
527549
uses: actions/checkout@v4
528550
with:
529551
ref: ${{ env.PR_HEAD_SHA }}
530-
token: ${{ steps.setup.outputs.token }}
552+
token: ${{ secrets.GH_PAT }}
531553
fetch-depth: 0 # Full history needed for diff generation
532554

533555
- name: Generate PR Diff for First Review
@@ -663,7 +685,7 @@ jobs:
663685
- name: Review PR with OpenCode
664686
if: github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true'
665687
env:
666-
GITHUB_TOKEN: ${{ steps.setup.outputs.token }}
688+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
667689
OPENCODE_PERMISSION: |
668690
{
669691
"bash": {
@@ -688,7 +710,7 @@ jobs:
688710
if: always() && (github.event_name != 'issue_comment' || steps.validate.outputs.should_proceed == 'true')
689711
continue-on-error: true
690712
env:
691-
GH_TOKEN: ${{ steps.setup.outputs.token }}
713+
GH_TOKEN: ${{ secrets.GH_PAT }}
692714
BOT_NAMES_JSON: ${{ env.BOT_NAMES_JSON }}
693715
PR_NUMBER: ${{ env.PR_NUMBER }}
694716
PR_HEAD_SHA: ${{ env.PR_HEAD_SHA }}

0 commit comments

Comments
 (0)