From a05b6b896d4d2d94d89ccc53e032aeb295a4f1c5 Mon Sep 17 00:00:00 2001 From: dceoy <1938249+dceoy@users.noreply.github.com> Date: Wed, 1 Jul 2026 20:54:34 +0900 Subject: [PATCH] chore: add OpenCode PR review and mention bot workflow Co-authored-by: Cursor --- .github/workflows/opencode.yml | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/opencode.yml diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml new file mode 100644 index 0000000..dd1d47d --- /dev/null +++ b/.github/workflows/opencode.yml @@ -0,0 +1,72 @@ +--- +name: Pull request review and mention bot using OpenCode +on: + pull_request: + types: + - opened + - ready_for_review + issue_comment: + types: + - created + pull_request_review_comment: + types: + - created + pull_request_review: + types: + - submitted + issues: + types: + - opened + - assigned +permissions: + contents: read +jobs: + opencode-review: + if: > + github.event_name == 'pull_request' + && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.pull_request.author_association) + && (! github.event.pull_request.draft) + && (! startsWith(github.head_ref, 'dependabot/')) + && (! startsWith(github.head_ref, 'renovate/')) + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + actions: read + uses: dceoy/gh-actions-for-devops/.github/workflows/opencode-review.yml@main # zizmor: ignore[unpinned-uses] + with: + model: opencode-go/kimi-k2.7-code + secrets: + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} + GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} + opencode-bot: + if: > + ( + (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') + && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) + && (contains(github.event.comment.body, '/oc') || contains(github.event.comment.body, '/opencode')) + ) || ( + github.event_name == 'pull_request_review' + && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association) + && (contains(github.event.review.body, '/oc') || contains(github.event.review.body, '/opencode')) + ) || ( + github.event_name == 'issues' + && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association) + && ( + (contains(github.event.issue.body, '/oc') || contains(github.event.issue.title, '/oc')) + || (contains(github.event.issue.body, '/opencode') || contains(github.event.issue.title, '/opencode')) + ) + ) + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + actions: read + uses: dceoy/gh-actions-for-devops/.github/workflows/opencode-bot.yml@main # zizmor: ignore[unpinned-uses] + with: + model: opencode-go/glm-5.2 + secrets: + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} + GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}