mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-04-23 12:26:17 +02:00
138 lines
5.7 KiB
YAML
138 lines
5.7 KiB
YAML
name: Issue & PR Automation
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
pull_request_target:
|
|
types: [opened]
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
models: read
|
|
id-token: write
|
|
|
|
jobs:
|
|
analyze-issue:
|
|
if: github.event_name == 'issues'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
|
|
|
|
- name: Check if first-time contributor
|
|
id: check-first-time
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
|
|
run: |
|
|
ISSUE_COUNT=$(gh api "/repos/${{ github.repository }}/issues" \
|
|
--jq "map(select(.user.login == \"$ISSUE_AUTHOR\" and .number != ${{ github.event.issue.number }})) | length" \
|
|
--paginate || echo "0")
|
|
|
|
if [ "$ISSUE_COUNT" = "0" ]; then
|
|
echo "is_first_time=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "is_first_time=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Analyze issue
|
|
uses: anomalyco/opencode/github@d954026dd855e018302a6c0733a1dd74140931df #v1.2.26
|
|
env:
|
|
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
model: zai-coding-plan/glm-4.7
|
|
prompt: |
|
|
You are a triage bot for Donut Browser (open-source anti-detect browser, Tauri + Next.js + Rust).
|
|
|
|
${{ steps.check-first-time.outputs.is_first_time == 'true' && 'This is a first-time contributor. Start your comment with: "Thanks for opening your first issue!"' || '' }}
|
|
|
|
Analyze this issue and post a single concise comment. Format:
|
|
|
|
1. One sentence acknowledging what the user wants.
|
|
2. A short **Action items** list — what specific info is missing or what the user should do next. Only include items that are actually missing. If the issue is complete, say so and skip this section.
|
|
3. Label the issue: add "bug" label for bug reports, "enhancement" label for feature requests.
|
|
|
|
Rules:
|
|
- Be brief. No filler, no generic tips, no templates.
|
|
- If it's a bug report, check for: reproduction steps, OS/version, error messages. Only ask for what's actually missing.
|
|
- If it's a feature request, check for: clear description of desired behavior, use case. Only ask for what's actually missing.
|
|
- If the issue already has everything needed, just acknowledge it and label it.
|
|
- Never exceed 6 items total.
|
|
|
|
analyze-pr:
|
|
if: github.event_name == 'pull_request_target' && github.actor != 'dependabot[bot]'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if first-time contributor
|
|
id: check-first-time
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
run: |
|
|
PR_COUNT=$(gh api "/repos/${{ github.repository }}/pulls?state=all&per_page=100" \
|
|
--jq "[.[] | select(.user.login == \"$PR_AUTHOR\" and .number != ${{ github.event.pull_request.number }})] | length" \
|
|
|| echo "0")
|
|
|
|
if [ "$PR_COUNT" = "0" ]; then
|
|
echo "is_first_time=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "is_first_time=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Analyze PR
|
|
uses: anomalyco/opencode/github@d954026dd855e018302a6c0733a1dd74140931df #v1.2.26
|
|
env:
|
|
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
model: zai-coding-plan/glm-4.7
|
|
prompt: |
|
|
You are a review bot for Donut Browser (open-source anti-detect browser, Tauri + Next.js + Rust).
|
|
|
|
${{ steps.check-first-time.outputs.is_first_time == 'true' && 'This is a first-time contributor. Start your comment with: "Thanks for your first PR!"' || '' }}
|
|
|
|
Review this PR and post a single concise comment. Format:
|
|
|
|
1. One sentence summarizing what this PR does.
|
|
2. **Action items** — only list things that actually need to be fixed or addressed. If the PR looks good, say so and skip this section.
|
|
|
|
Rules:
|
|
- Be brief. No filler, no praise padding.
|
|
- Focus on: bugs, security issues, missing edge cases, breaking changes.
|
|
- If the PR touches UI text or adds new strings, remind to update translation files in src/i18n/locales/.
|
|
- If the PR modifies Tauri commands, remind to check the unused-commands test.
|
|
- Do not nitpick style or formatting — the project has automated linting.
|
|
- Never exceed 8 lines total.
|
|
|
|
opencode-command:
|
|
if: |
|
|
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
|
|
(contains(github.event.comment.body, ' /oc') ||
|
|
startsWith(github.event.comment.body, '/oc') ||
|
|
contains(github.event.comment.body, ' /opencode') ||
|
|
startsWith(github.event.comment.body, '/opencode'))
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
|
|
|
|
- name: Run opencode
|
|
uses: anomalyco/opencode/github@d954026dd855e018302a6c0733a1dd74140931df #v1.2.26
|
|
env:
|
|
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
model: zai-coding-plan/glm-4.7
|