AI Commit Comment #98
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: AI Commit Comment | |
| on: | |
| push: | |
| branches: | |
| - "dev/*" | |
| - "ai/**" | |
| workflow_run: | |
| workflows: ["Build & Test", "Build & Test Backend", "Build & Test Frontend"] | |
| types: | |
| - completed | |
| branches: | |
| - "dev/*" | |
| - "ai/**" | |
| jobs: | |
| ai-comment: | |
| name: Review & Comment on HEAD Commit | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/heads/dev/') || startsWith(github.ref, 'refs/heads/ai/') || (github.event.workflow_run.conclusion == 'success' && (startsWith(github.event.workflow_run.head_branch, 'dev/') || startsWith(github.event.workflow_run.head_branch, 'ai/'))) | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout full history | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # For workflow_run events, checkout the head branch | |
| ref: ${{ github.event.workflow_run.head_branch || github.ref }} | |
| - name: Authenticate as GitHub App | |
| id: app-auth | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| owner: ${{ github.repository_owner }} | |
| repositories: ${{ github.event.repository.name }} | |
| - name: Setup Node.js with AI tools | |
| uses: ./.github/actions/setup-node-ai | |
| with: | |
| checkout: 'false' # Skip checkout since we already did it | |
| fetch-depth: 0 | |
| - name: Comment on HEAD commit via ChatGPT | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GITHUB_TOKEN: ${{ steps.app-auth.outputs.token || secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| HEAD_SHA: ${{ github.event.workflow_run.head_sha || github.event.head_commit.id || github.sha }} | |
| OPENAI_MODEL: ${{ vars.OPENAI_MODEL || 'gpt-5-mini' }} | |
| run: | | |
| echo "Running AI commit comment script..." | |
| node scripts/ai-commit-comment.mjs |