diff --git a/.github/workflows/ghbot.yml b/.github/workflows/ghbot.yml new file mode 100644 index 0000000..9c6bb04 --- /dev/null +++ b/.github/workflows/ghbot.yml @@ -0,0 +1,74 @@ +name: ghbot + +on: + pull_request_target: + types: + - opened + - synchronize + - reopened + - ready_for_review + - edited + - closed + issues: + types: + - opened + - edited + - reopened + issue_comment: + types: + - created + pull_request_review: + types: + - submitted + +permissions: + actions: write + contents: write + pull-requests: write + checks: write + statuses: read + issues: write + +jobs: + review: + if: | + github.event_name == 'pull_request_target' || + github.event_name == 'issues' || + (github.event_name == 'issue_comment' && github.event.issue.pull_request != null) || + github.event_name == 'pull_request_review' + uses: lezi-fun/ghbot/.github/workflows/review-reusable.yml@main + secrets: + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} + GH_APP_ID: ${{ secrets.GH_APP_ID }} + GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }} + GH_APP_INSTALLATION_ID: ${{ secrets.GH_APP_INSTALLATION_ID }} + with: + event_name: ${{ github.event_name }} + event_action: ${{ github.event.action }} + repository_owner: ${{ github.repository_owner }} + repository_name: ${{ github.event.repository.name }} + repository_id: ${{ github.repository_id }} + pull_number: ${{ github.event.pull_request.number || github.event.issue.number }} + comment_id: ${{ github.event.comment.id || '' }} + commenter_login: ${{ github.event.comment.user.login || '' }} + comment_body: ${{ github.event.comment.body || '' }} + reviewer_login: ${{ github.event.review.user.login || '' }} + review_state: ${{ github.event.review.state || '' }} + review_commit_id: ${{ github.event.review.commit_id || '' }} + bot_name: ${{ vars.BOT_NAME || 'github-actions[bot]' }} + opencode_base_url: ${{ vars.OPENCODE_BASE_URL || 'https://api.openai.com/v1' }} + opencode_model: ${{ vars.OPENCODE_MODEL || 'gpt-5.4' }} + opencode_reasoning_effort: ${{ vars.OPENCODE_REASONING_EFFORT || 'high' }} + review_policy: ${{ vars.REVIEW_POLICY || 'require_approval' }} + review_instructions: ${{ vars.REVIEW_INSTRUCTIONS || '' }} + review_branches: ${{ vars.REVIEW_BRANCHES || '' }} + triage_enabled: ${{ vars.TRIAGE_ENABLED || 'true' }} + triage_labels: ${{ vars.TRIAGE_LABELS || 'bug,enhancement,documentation,question' }} + triage_duplicate_label: ${{ vars.TRIAGE_DUPLICATE_LABEL || 'duplicate' }} + triage_candidate_limit: ${{ vars.TRIAGE_CANDIDATE_LIMIT || '50' }} + triage_instructions: ${{ vars.TRIAGE_INSTRUCTIONS || '' }} + auto_merge: ${{ vars.AUTO_MERGE || 'false' }} + merge_method: ${{ vars.MERGE_METHOD || 'squash' }} + require_checks: ${{ vars.REQUIRE_CHECKS || 'true' }} + max_patch_chars: ${{ vars.MAX_PATCH_CHARS || '120000' }} + log_level: info