mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 14:41:23 +08:00
66 lines
2.1 KiB
YAML
66 lines
2.1 KiB
YAML
name: opencode
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
bot:
|
|
if: |
|
|
(contains(github.event.comment.body, ' /oc') ||
|
|
startsWith(github.event.comment.body, '/oc') ||
|
|
contains(github.event.comment.body, ' /opencode') ||
|
|
startsWith(github.event.comment.body, '/opencode')) &&
|
|
github.actor != 'opencode-agent[bot]' &&
|
|
github.actor != 'takanashi-hoshino-agent[bot]' &&
|
|
github.actor != 'github-actions[bot]'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Fetch config from CF Worker
|
|
id: cfg
|
|
uses: MoeFurina/pull-oc-config@v1
|
|
with:
|
|
url: https://bot-storage.interface.focalors.ltd/config
|
|
|
|
- name: Generate bot token
|
|
id: token
|
|
uses: actions/create-github-app-token@v1
|
|
with:
|
|
app-id: ${{ steps.cfg.outputs.app_id }}
|
|
private-key: ${{ steps.cfg.outputs.app_private_key }}
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
# 需要持久化凭证: opencode action 内部会 git fetch origin <分支> 拉取 PR 代码
|
|
persist-credentials: true
|
|
token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: Configure git identity
|
|
run: |
|
|
git config --global user.name "takanashi-hoshino-agent[bot]"
|
|
git config --global user.email "takanashi-hoshino-agent[bot]@users.noreply.github.com"
|
|
|
|
- name: Run opencode
|
|
uses: anomalyco/opencode/github@latest
|
|
env:
|
|
OPENCODE_API_KEY: ${{ steps.cfg.outputs.opencode_api_key }}
|
|
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
|
|
with:
|
|
model: opencode/deepseek-v4-flash-free
|
|
use_github_token: true
|
|
prompt: |
|
|
${{ steps.cfg.outputs.opencode_prompt }}
|
|
|
|
## 用户指令(来自触发评论,请严格按此执行)
|
|
${{ github.event.comment.body }} |