diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..6844720 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,73 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened] + pull_request_review: + types: [submitted] + +jobs: + 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' + ) && ( + 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 + pull-requests: write + issues: write + actions: read + 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 + 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."