|
| 1 | +name: Claude Code / Interactive |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + pull_request_review_comment: |
| 7 | + types: [created] |
| 8 | + issues: |
| 9 | + types: [opened, assigned, labeled] |
| 10 | + pull_request: |
| 11 | + types: [opened, assigned, labeled] |
| 12 | + pull_request_review: |
| 13 | + types: [submitted] |
| 14 | + |
| 15 | +jobs: |
| 16 | + claude: |
| 17 | + if: | |
| 18 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
| 19 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
| 20 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
| 21 | + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude') || (github.event.action == 'labeled' && github.event.label.name == 'claude'))) || |
| 22 | + (github.event_name == 'pull_request' && (contains(github.event.pull_request.body, '@claude') || contains(github.event.pull_request.title, '@claude') || (github.event.action == 'labeled' && github.event.label.name == 'claude'))) |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: write |
| 26 | + pull-requests: write |
| 27 | + issues: write |
| 28 | + id-token: write |
| 29 | + actions: read # Required for Claude to read CI results on PRs |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + |
| 36 | + - name: Install uv |
| 37 | + uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 |
| 38 | + with: |
| 39 | + version-file: "pyproject.toml" |
| 40 | + enable-cache: true |
| 41 | + cache-dependency-glob: uv.lock |
| 42 | + |
| 43 | + - name: Install dev tools |
| 44 | + if: ${{ matrix.runner == 'ubuntu-latest' || matrix.runner == 'ubuntu-24.04-arm' }} |
| 45 | + shell: bash |
| 46 | + run: .github/workflows/_install_dev_tools.bash |
| 47 | + |
| 48 | + - name: Install Python, venv and dependencies |
| 49 | + shell: bash |
| 50 | + run: uv sync --all-extras --frozen --link-mode=copy |
| 51 | + |
| 52 | + - name: Setup display |
| 53 | + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 |
| 54 | + |
| 55 | + - name: Create .env file |
| 56 | + uses: SpicyPizza/create-envfile@ace6d4f5d7802b600276c23ca417e669f1a06f6f # v2.0.3 |
| 57 | + with: |
| 58 | + envkey_AIGNOSTICS_CLIENT_ID_DEVICE: ${{ secrets.AIGNOSTICS_CLIENT_ID_DEVICE }} |
| 59 | + envkey_AIGNOSTICS_REFRESH_TOKEN: ${{ secrets.AIGNOSTICS_REFRESH_TOKEN }} |
| 60 | + fail_on_empty: false |
| 61 | + |
| 62 | + - name: Set up GCP credentials for bucket access |
| 63 | + shell: bash |
| 64 | + env: |
| 65 | + GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} |
| 66 | + run: | |
| 67 | + echo "$GCP_CREDENTIALS" | base64 -d > credentials.json |
| 68 | + echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/credentials.json" >> $GITHUB_ENV |
| 69 | +
|
| 70 | + - name: Print development version info |
| 71 | + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + TOML_VERSION=$(uv run python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])") |
| 75 | + echo "Development build - Current version in pyproject.toml: $TOML_VERSION" |
| 76 | +
|
| 77 | + - name: Run Claude Code / Interactive |
| 78 | + id: claude-code-interactive |
| 79 | + uses: anthropics/claude-code-action@v1 |
| 80 | + with: |
| 81 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 82 | + track_progress: true |
| 83 | + additional_permissions: | |
| 84 | + actions: read |
| 85 | + allowed_bots: "dependabot[bot],renovate[bot]" |
| 86 | + claude_args: >- |
| 87 | + --max-turns 200 |
| 88 | + --model claude-sonnet-4-5-20250929 |
| 89 | + --allowed-tools "mcp__github_inline_comment__create_inline_comment,Read,Write,Edit,MultiEdit,Glob,Grep,LS,WebFetch,WebSearch,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*),Bash(uv:*),Bash(make:*)" |
| 90 | + --system-prompt "Enable the contributor given their ask while insisting on highest standards: |
| 91 | + * Apply best practices in enterprise grade software engineering. |
| 92 | + * Use the repository's CLAUDE.md and recursively referenced documents for guidance on style and conventions. |
| 93 | + * Raise the bar on engineering and operational excellence in this repository. |
| 94 | + * Do research on any libraries, frameworks, principles or tools you are not familiar with. |
| 95 | + * uv, python and further development dependencies are already installed. |
| 96 | + * Use `uv sync --all-extras` to install any missing dependencies for your branch. |
| 97 | + * Use 'uv run pytest ...' to run tests you created. |
| 98 | + * Use 'uv run aignostics ...' to run the CLI and commands you added. |
| 99 | + * As a final validation of your code changes run the unit, integration and e2e test suite. |
| 100 | + * Use 'make test_unit' to run the unit test suite. |
| 101 | + * Use 'make test_integration' to run the integration test suite. |
| 102 | + * Use 'make test e2e' to run the e2e tests suite. |
| 103 | + * If the validation fails, iterate. |
| 104 | + " |
| 105 | +
|
| 106 | + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md |
| 107 | + # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options |
0 commit comments