From 3ebf2336b1093d62ea507bf14a54c3a9ce365515 Mon Sep 17 00:00:00 2001 From: Trent Date: Sat, 19 Jul 2025 21:47:36 +1000 Subject: [PATCH 1/4] Claude PR Assistant workflow --- .github/workflows/claude.yml | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 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 00000000..64a3e5b1 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,64 @@ +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: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@beta + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # This is an optional setting that allows Claude to read CI results on PRs + additional_permissions: | + actions: read + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + + # Optional: Customize the trigger phrase (default: @claude) + # trigger_phrase: "/claude" + + # Optional: Trigger when specific user is assigned to an issue + # assignee_trigger: "claude-bot" + + # Optional: Allow Claude to run specific commands + # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" + + # Optional: Add custom instructions for Claude to customize its behavior for your project + # custom_instructions: | + # Follow our coding standards + # Ensure all new code has tests + # Use TypeScript for new files + + # Optional: Custom environment variables for Claude + # claude_env: | + # NODE_ENV: test + From e75a3c271193f92b17700bc3e8d913be8893bc70 Mon Sep 17 00:00:00 2001 From: Trent Date: Sat, 19 Jul 2025 21:47:37 +1000 Subject: [PATCH 2/4] Claude Code Review workflow --- .github/workflows/claude-code-review.yml | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/claude-code-review.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 00000000..5bf8ce59 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,78 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + # Optional: Only run on specific file changes + # paths: + # - "src/**/*.ts" + # - "src/**/*.tsx" + # - "src/**/*.js" + # - "src/**/*.jsx" + +jobs: + claude-review: + # Optional: Filter by PR author + # if: | + # github.event.pull_request.user.login == 'external-contributor' || + # github.event.pull_request.user.login == 'new-developer' || + # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@beta + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + + # Direct prompt for automated review (no @claude mention needed) + direct_prompt: | + Please review this pull request and provide feedback on: + - Code quality and best practices + - Potential bugs or issues + - Performance considerations + - Security concerns + - Test coverage + + Be constructive and helpful in your feedback. + + # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR + # use_sticky_comment: true + + # Optional: Customize review based on file types + # direct_prompt: | + # Review this PR focusing on: + # - For TypeScript files: Type safety and proper interface usage + # - For API endpoints: Security, input validation, and error handling + # - For React components: Performance, accessibility, and best practices + # - For tests: Coverage, edge cases, and test quality + + # Optional: Different prompts for different authors + # direct_prompt: | + # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && + # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || + # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} + + # Optional: Add specific tools for running tests or linting + # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" + + # Optional: Skip review for certain conditions + # if: | + # !contains(github.event.pull_request.title, '[skip-review]') && + # !contains(github.event.pull_request.title, '[WIP]') + From d1670bc96a865ad5618e836a32a08dddc86c482c Mon Sep 17 00:00:00 2001 From: stanvx Date: Sat, 19 Jul 2025 22:08:04 +1000 Subject: [PATCH 3/4] feat: configure Claude workflows for author-only execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Restrict both workflows to only run for stanvx (repository owner) - Add Kotlin Multiplatform specific file path filtering - Customize prompts for Kotlin/Android development context - Enable Gradle commands for Claude interactive workflow - Add project-specific instructions for Clean Architecture patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/claude-code-review.yml | 36 +++++++++++++----------- .github/workflows/claude.yml | 30 ++++++++++++-------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 5bf8ce59..46216e39 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -3,20 +3,20 @@ name: Claude Code Review on: pull_request: types: [opened, synchronize] - # Optional: Only run on specific file changes - # paths: - # - "src/**/*.ts" - # - "src/**/*.tsx" - # - "src/**/*.js" - # - "src/**/*.jsx" + # Run on Kotlin/Android files since this is a Kotlin Multiplatform project + paths: + - "shared/**/*.kt" + - "core/**/*.kt" + - "lib/**/*.kt" + - "iosApp/**/*.swift" + - "androidApp/**/*.kt" + - "build.gradle.kts" + - "gradle/**" jobs: claude-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + # Only run for PRs created by the repository owner + if: github.event.pull_request.user.login == 'stanvx' runs-on: ubuntu-latest permissions: @@ -40,13 +40,17 @@ jobs: # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) # model: "claude-opus-4-20250514" - # Direct prompt for automated review (no @claude mention needed) + # Customized prompt for Kotlin Multiplatform project direct_prompt: | - Please review this pull request and provide feedback on: - - Code quality and best practices + Please review this Kotlin Multiplatform pull request and provide feedback on: + - Kotlin code quality and best practices + - Proper use of expect/actual patterns for platform-specific code + - Compose Multiplatform UI patterns and performance + - Clean Architecture layer boundaries (UI → Presentation → Domain → Data) + - Coroutines and StateFlow usage + - Dependency injection with Koin - Potential bugs or issues - - Performance considerations - - Security concerns + - Security concerns (especially for audio processing and file I/O) - Test coverage Be constructive and helpful in your feedback. diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 64a3e5b1..d7884654 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -13,10 +13,12 @@ on: jobs: claude: if: | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || - (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + ( + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && github.event.comment.user.login == 'stanvx') || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && github.event.comment.user.login == 'stanvx') || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && github.event.review.user.login == 'stanvx') || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && github.event.issue.user.login == 'stanvx') + ) runs-on: ubuntu-latest permissions: contents: read @@ -49,14 +51,20 @@ jobs: # Optional: Trigger when specific user is assigned to an issue # assignee_trigger: "claude-bot" - # Optional: Allow Claude to run specific commands - # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" + # Allow Claude to run Gradle and Android-specific commands + allowed_tools: "Bash(./gradlew build),Bash(./gradlew testDebug),Bash(./gradlew assembleDebug),Bash(./gradlew clean)" - # Optional: Add custom instructions for Claude to customize its behavior for your project - # custom_instructions: | - # Follow our coding standards - # Ensure all new code has tests - # Use TypeScript for new files + # Custom instructions for Kotlin Multiplatform project + custom_instructions: | + This is a Kotlin Multiplatform project (Notely Capture) with the following guidelines: + - Follow Clean Architecture patterns (UI → Presentation → Domain → Data) + - Use expect/actual for platform-specific code + - Prefer Compose Multiplatform for UI + - Use Koin for dependency injection + - Follow immutable data patterns with StateFlow + - Write tests for business logic in use cases + - Respect layer boundaries and use explicit mappers + - Focus on Android development primarily # Optional: Custom environment variables for Claude # claude_env: | From 0caffb8004dbaf78351cf49109f145b24e0bf558 Mon Sep 17 00:00:00 2001 From: stanvx Date: Sat, 19 Jul 2025 22:12:04 +1000 Subject: [PATCH 4/4] fix: enable sticky comments for Claude Code Review workflow --- .github/workflows/claude-code-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 46216e39..73402671 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -56,7 +56,7 @@ jobs: Be constructive and helpful in your feedback. # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR - # use_sticky_comment: true + use_sticky_comment: true # Optional: Customize review based on file types # direct_prompt: |