diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1f8c43606b..d99079e80e 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -98,6 +98,8 @@ This is a React-based monitoring and management interface for YDB clusters. The - Run `npm run lint` and `npm run typecheck` before committing - Follow conventional commit message format +- Use conventional commit format for PR titles with lowercase subjects (e.g., "fix: update api endpoints", "feat: add new component", "chore: update dependencies") +- PR title subjects must be lowercase (no proper nouns, sentence-case, start-case, pascal-case, or upper-case) - Ensure all user-facing text is internationalized - Test with a local YDB instance when possible diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 94900b23e5..e79cf152a1 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -9,8 +9,8 @@ jobs: claude-review: if: | github.event_name == 'workflow_dispatch' || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && contains(github.event.comment.body, '/claude_review')) runs-on: ubuntu-latest @@ -21,10 +21,26 @@ jobs: id-token: write steps: + - name: Get PR details + id: pr-details + if: github.event_name == 'issue_comment' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PR_NUMBER="${{ github.event.issue.number }}" + PR_DATA=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}") + PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r '.head.sha') + echo "pr_head_sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 1 + # For workflow_dispatch, checkout default branch + # For issue_comment on PR, checkout the PR head commit + ref: ${{ github.event_name == 'issue_comment' && steps.pr-details.outputs.pr_head_sha || github.ref }} + fetch-depth: 0 - name: Run Claude Code Review id: claude-review diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 6e549ec365..2fc3465f3d 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -9,8 +9,8 @@ jobs: claude: if: | github.event_name == 'workflow_dispatch' || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && contains(github.event.comment.body, '@claude')) runs-on: ubuntu-latest permissions: @@ -20,10 +20,26 @@ jobs: id-token: write actions: read # Required for Claude to read CI results on PRs steps: + - name: Get PR details + id: pr-details + if: github.event_name == 'issue_comment' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PR_NUMBER="${{ github.event.issue.number }}" + PR_DATA=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}") + PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r '.head.sha') + echo "pr_head_sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 1 + # For workflow_dispatch, checkout default branch + # For issue_comment on PR, checkout the PR head commit + ref: ${{ github.event_name == 'issue_comment' && steps.pr-details.outputs.pr_head_sha || github.ref }} + fetch-depth: 0 - name: Run Claude Code id: claude