From e8f1fa05373f77792d9c75f5f46fe4035b6b7cc9 Mon Sep 17 00:00:00 2001 From: kirich1409 Date: Sun, 15 Feb 2026 00:23:35 +0300 Subject: [PATCH 1/2] ci: add Claude Code GitHub Action workflow Co-Authored-By: Claude Opus 4.6 --- .github/workflows/claude.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/claude.yml diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..c2d72e3 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,58 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + # Only allow trusted collaborators to trigger Claude + if: | + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR' || + github.event.review.author_association == 'OWNER' || + github.event.review.author_association == 'MEMBER' || + github.event.review.author_association == 'COLLABORATOR' || + github.event.issue.author_association == 'OWNER' || + github.event.issue.author_association == 'MEMBER' || + github.event.issue.author_association == 'COLLABORATOR' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_args: | + --model claude-opus-4-6 + --max-turns 20 + --allowedTools "Bash(./gradlew check),Bash(./gradlew assembleRelease),Bash(./gradlew ktlintFormat),Bash(./gradlew ktlintCheck),Bash(./gradlew detekt),Bash(./gradlew testDebugUnitTest),Bash(./gradlew koverHtmlReport),Bash(./gradlew koverXmlReport),Bash(./gradlew :vbpd-core:*),Bash(./gradlew :vbpd:*),Bash(./gradlew :vbpd-reflection:*),Bash(./gradlew :sample:*),Bash(git status),Bash(git diff),Bash(git log*),Bash(git show*)" + --system-prompt "Android library project (ViewBindingPropertyDelegate). Three modules: vbpd-core (foundation), vbpd (lifecycle delegates), vbpd-reflection (reflection + cache). Follow CLAUDE.md: explicit API mode required, Kotlin code style 'official', JVM target 11. Always run ktlintFormat before commit. Use './gradlew check' to verify. PRs → develop (feature/fix/chore/docs branches), hotfixes → master. Version in gradle/libs.versions.toml. Package: dev.androidbroadcast.vbpd." From 8d6e737f4059dfc5a384b341865bfdb81ed58f78 Mon Sep 17 00:00:00 2001 From: kirich1409 Date: Sun, 15 Feb 2026 00:28:52 +0300 Subject: [PATCH 2/2] fix: add @claude mention filter, PR ref checkout, remove assigned trigger - Add contains(@claude) check to prevent triggering on unrelated comments - Add dynamic ref for PR context checkout (refs/pull/N/head) - Remove 'assigned' from issues trigger (author_association != assignee) Co-Authored-By: Claude Opus 4.6 --- .github/workflows/claude.yml | 37 +++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index c2d72e3..6844720 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -6,23 +6,29 @@ on: pull_request_review_comment: types: [created] issues: - types: [opened, assigned] + types: [opened] pull_request_review: types: [submitted] jobs: claude: - # Only allow trusted collaborators to trigger Claude + # Only allow trusted collaborators to trigger Claude when explicitly mentioned if: | - github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'COLLABORATOR' || - github.event.review.author_association == 'OWNER' || - github.event.review.author_association == 'MEMBER' || - github.event.review.author_association == 'COLLABORATOR' || - github.event.issue.author_association == 'OWNER' || - github.event.issue.author_association == 'MEMBER' || - github.event.issue.author_association == 'COLLABORATOR' + ( + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR' || + github.event.review.author_association == 'OWNER' || + github.event.review.author_association == 'MEMBER' || + github.event.review.author_association == 'COLLABORATOR' || + github.event.issue.author_association == 'OWNER' || + github.event.issue.author_association == 'MEMBER' || + github.event.issue.author_association == 'COLLABORATOR' + ) && ( + contains(github.event.comment.body || '', '@claude') || + contains(github.event.review.body || '', '@claude') || + contains(github.event.issue.body || '', '@claude') + ) runs-on: ubuntu-latest permissions: contents: write @@ -32,6 +38,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v6 + with: + ref: >- + ${{ + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + format('refs/pull/{0}/head', github.event.issue.number)) || + (github.event.pull_request && + format('refs/pull/{0}/head', github.event.pull_request.number)) || + github.sha + }} - name: Set up JDK 21 uses: actions/setup-java@v5