diff --git a/template/.github/workflows/claude.yaml.jinja b/template/.github/workflows/claude.yaml.jinja new file mode 100644 index 0000000..73c0110 --- /dev/null +++ b/template/.github/workflows/claude.yaml.jinja @@ -0,0 +1,68 @@ +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: | + {% raw %}(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'))){% endraw %} + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + steps: + + - name: Clone Repository + uses: actions/checkout@v4 + + - name: Prepare Python and Hatch + uses: ./.github/actions/python-hatch + with: + needs-clone: false + python-version: '3.10' + + - name: Create CLAUDE.md symlink + run: | + if [ -f ".auxiliary/configuration/conventions.md" ]; then + ln -sf .auxiliary/configuration/conventions.md CLAUDE.md + echo "::notice::Created symlink: CLAUDE.md -> .auxiliary/configuration/conventions.md" + else + echo "::error file=.auxiliary/configuration/conventions.md::Required conventions file not found" + exit 1 + fi + shell: bash + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@beta + with: + anthropic_api_key: {% raw %}'${{ secrets.ANTHROPIC_API_KEY }}'{% endraw %} + trigger_phrase: "/claude" + timeout_minutes: 20 + allowed_tools: | + Bash(hatch --env develop run linters) + Bash(hatch --env develop run testers) + Bash(hatch --env develop run docsgen) + Bash(hatch --env develop run packagers) + Bash(hatch run python:*) + Bash(git status) + Bash(git add:*) + Bash(git commit:*) + Bash(python:*) + Bash(pip:*) + Edit(**) + Write(**) \ No newline at end of file