summaryrefslogtreecommitdiffstats
path: root/.github/workflows/claude.yml
blob: f4bb5861057c4ff331f2ae0be093b756a60bcd91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: ClaudeCode - Slang Assistant

permissions:
  contents: write
  pull-requests: write
  issues: write
  actions: read
  id-token: write

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request_review:
    types: [submitted]

env:
  AWS_REGION: ${{ vars.AWS_REGION }}
  AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ vars.AWS_SECRET_ACCESS_KEY }}

jobs:
  claude:
    name: Claude Code Assistant
    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')))

    runs-on: ubuntu-latest
    timeout-minutes: 360

    # Cancel previous runs on new pushes
    concurrency:
      group: claude-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
      cancel-in-progress: true

    steps:
      # Format setup and environment preparation
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: false

      - name: Checkout of submodules
        run: git submodule update --init --recursive --depth=1

      - name: Format Setup and Environment Preparation
        uses: ./.github/actions/format-setup

      # Complete Claude execution with authentication, setup, and execution
      - name: Run Claude Code
        id: claude
        uses: ./.github/actions/claude-code-runner
        with:
          # Authentication (these secrets must be configured in your repository)
          llmgw-id: ${{ secrets.LLMGW_ID }}
          llmgw-secret: ${{ secrets.LLMGW_SECRET }}
          llmgw-token-url: ${{ secrets.LLMGW_TOKEN_URL }}
          github-token-fallback: ${{ secrets.GITHUB_TOKEN }}

          # Repository-specific setup
          setup-commands: |
            set -euo pipefail
            echo "🏗️ Setting up environment dependencies..."

            sudo apt-get update
            sudo apt-get install -y libx11-dev

            # Configure and build the project
            cmake --preset default --fresh
            cmake --workflow --preset debug

            echo "✅ Environment setup completed"

          # Custom instructions for Slang
          custom-instructions: |
            ### **Build System Information:**
            - OS: Ubuntu Linux
            - Build commands: Configure `cmake --preset default`, Build `cmake --build --preset debug`, Test `./build/Debug/bin/slang-test tests/path/to/test.slang`
            - Project is pre-built and ready for development tasks

            ### **IMPORTANT: Deep Repository Knowledge & Debugging**
            **Repository Knowledge Tool**: Use `mcp__deepwiki__ask_question` with repoName "shader-slang/slang" for architectural insights and implementation patterns.

            **Implementation Guidelines:**
            - Use git history (`git log -S "keyword"`) to find related features but don't spend excessive time
            - Use deepwiki for expert insights and architectural patterns
            - Think carefully about the user's request before implementing

            ### **Test-Driven Development - Strongly Encouraged**
            Write failing tests in `tests/` directory, implement fixes and verify both tests and builds succeed before submitting.

          # MCP configuration for deepwiki
          mcp-config: |
            {
              "mcpServers": {
                "deepwiki": {
                  "type": "sse",
                  "url": "https://mcp.deepwiki.com/sse"
                }
              }
            }

          # Advanced configuration (using repository variables)
          model: ${{ vars.ANTHROPIC_MODEL }}
          aws-region: ${{ vars.AWS_REGION }}
          bedrock-base-url: ${{ vars.ANTHROPIC_BEDROCK_BASE_URL }}
          small-fast-model: ${{ vars.ANTHROPIC_SMALL_FAST_MODEL }}

          # Additional tools for deepwiki
          allowed-tools: "Bash,View,GlobTool,GrepTool,BatchTool,Write,mcp__deepwiki__ask_question"