Add jira-claude integration #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude PR Assistant | |
| on: | |
| workflow_run: | |
| workflows: ["Test"] | |
| types: [completed] | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| jobs: | |
| # --- Resolve PR data for auto-review --- | |
| resolve-pr: | |
| permissions: | |
| contents: read | |
| if: >- | |
| github.repository_owner == 'viamrobotics' && | |
| github.event_name == 'workflow_run' && | |
| github.event.workflow_run.conclusion == 'success' && | |
| startsWith(github.event.workflow_run.head_branch, 'claude/') | |
| runs-on: ubuntu-latest | |
| outputs: | |
| pr_found: ${{ steps.pr.outputs.found }} | |
| pr_number: ${{ steps.pr.outputs.number }} | |
| pr_title: ${{ steps.pr.outputs.title }} | |
| branch: ${{ steps.pr.outputs.branch }} | |
| steps: | |
| - name: Find PR for branch | |
| id: pr | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const branch = context.payload.workflow_run.head_branch; | |
| const { data: pulls } = await github.rest.pulls.list({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| head: `${context.repo.owner}:${branch}`, | |
| state: 'open' | |
| }); | |
| if (pulls.length === 0) { | |
| core.info('No open PR found for branch ' + branch); | |
| core.setOutput('found', 'false'); | |
| return; | |
| } | |
| const pr = pulls[0]; | |
| core.setOutput('found', 'true'); | |
| core.setOutput('number', String(pr.number)); | |
| core.setOutput('title', pr.title); | |
| core.setOutput('branch', branch); | |
| # --- Auto-review after CI passes on claude/* branch --- | |
| auto-review: | |
| needs: resolve-pr | |
| if: needs.resolve-pr.outputs.pr_found == 'true' | |
| # viamrobotics/claude-ci-workflows@v1.17.3 | |
| uses: viamrobotics/claude-ci-workflows/.github/workflows/claude-auto-review.yml@3ad96b0ccbb5ee0d7e2cde98653fae0c453e68bb | |
| with: | |
| pr_number: ${{ needs.resolve-pr.outputs.pr_number }} | |
| pr_title: ${{ needs.resolve-pr.outputs.pr_title }} | |
| branch: ${{ needs.resolve-pr.outputs.branch }} | |
| container: 'debian:bookworm' | |
| install_command: 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install build-essential ca-certificates cmake curl g++ git gnupg libboost-all-dev libc-ares-dev libgrpc++-dev libprotobuf-dev libre2-dev libssl-dev ninja-build pkg-config protobuf-compiler-grpc software-properties-common sudo wget zlib1g-dev && bash -c "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -" && apt-add-repository -y "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main" && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -t llvm-toolchain-bookworm-15 clang-15 clang-tidy-15 clang-format && mkdir -p build && cd build && cmake .. -G Ninja -DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON -DVIAMCPPSDK_BUILD_TESTS=ON -DVIAMCPPSDK_BUILD_EXAMPLES=OFF -DVIAMCPPSDK_CLANG_TIDY=ON && cmake --build . --target install' | |
| allowed_tools: 'Edit,Read,Write,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(cmake *),Bash(cmake --build *),Bash(ninja *),Bash(ctest *),Bash(make *),Bash(./bin/run-clang-format*),Bash(git config *),Bash(git add *),Bash(git commit *),Bash(git push *),Bash(git status*),Bash(git diff*),Bash(git -C * diff*),Bash(git log*),Bash(git checkout *),Bash(git branch *),Bash(git rev-parse *),Bash(git fetch *),Bash(gh pr review*),Bash(gh pr comment*),Bash(gh pr diff*),Bash(gh pr view*),Bash(gh api repos/*/pulls/*/comments*)' | |
| extra_review_instructions: | | |
| - Ensure src/viam/api/ was not modified (auto-generated protobuf files). | |
| secrets: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} | |
| SLACK_AI_WORKFLOW_ALERT_WEBHOOK_URL: ${{ secrets.SLACK_AI_WORKFLOW_ALERT_WEBHOOK_URL }} | |
| # --- On-demand review or fix via @claude mention --- | |
| on-demand: | |
| if: >- | |
| github.repository_owner == 'viamrobotics' && | |
| ( | |
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | |
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) | |
| ) | |
| # viamrobotics/claude-ci-workflows@v1.17.3 | |
| uses: viamrobotics/claude-ci-workflows/.github/workflows/claude-pr-assistant.yml@3ad96b0ccbb5ee0d7e2cde98653fae0c453e68bb | |
| with: | |
| container: 'debian:bookworm' | |
| install_command: 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install build-essential ca-certificates cmake curl g++ git gnupg libboost-all-dev libc-ares-dev libgrpc++-dev libprotobuf-dev libre2-dev libssl-dev ninja-build pkg-config protobuf-compiler-grpc software-properties-common sudo wget zlib1g-dev && bash -c "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -" && apt-add-repository -y "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main" && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -t llvm-toolchain-bookworm-15 clang-15 clang-tidy-15 clang-format && mkdir -p build && cd build && cmake .. -G Ninja -DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON -DVIAMCPPSDK_BUILD_TESTS=ON -DVIAMCPPSDK_BUILD_EXAMPLES=OFF -DVIAMCPPSDK_CLANG_TIDY=ON && cmake --build . --target install' | |
| allowed_tools: 'Edit,Read,Write,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(cmake *),Bash(cmake --build *),Bash(ninja *),Bash(ctest *),Bash(make *),Bash(./bin/run-clang-format*),Bash(git config *),Bash(git add *),Bash(git commit *),Bash(git push *),Bash(git status*),Bash(git diff*),Bash(git -C * diff*),Bash(git log*),Bash(git checkout *),Bash(git branch *),Bash(git rev-parse *),Bash(git fetch *),Bash(gh pr diff*),Bash(gh pr view*),Bash(gh api repos/*/pulls/*/comments*)' | |
| extra_review_instructions: | | |
| - Ensure src/viam/api/ was not modified (auto-generated protobuf files). | |
| secrets: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} |