diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index 935595f24..2b4f14759 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -1,21 +1,32 @@ -name: AI Code Review -run-name: Running AI code review on ${{ github.actor }}'s branch +name: AI Command Handler +run-name: Triggering AI review commands on PR #${{ inputs.prId }} + +concurrency: + group: ai-command-${{ github.event.inputs.prId || github.event.pull_request.number }} + cancel-in-progress: true on: pull_request: types: [opened, reopened, ready_for_review, synchronize] - issue_comment: - types: [created] + workflow_dispatch: + inputs: + prId: + description: "PR to deploy" + required: false + repository: + description: "The repository from which the slash command was dispatched" + required: false + comment-id: + description: "The comment-id of the slash command" + required: false + author: + description: "The author that triggered this actions" + required: false permissions: - contents: write - issues: write + contents: read pull-requests: write -concurrency: - group: pr-ai-${{ github.event.number || github.event.issue.number }}-${{ github.event.comment.body || 'pr' }} - cancel-in-progress: true - jobs: getPRHead: name: Get PR head SHA @@ -38,9 +49,8 @@ jobs: pull_number: parseInt(prId, 10) }); return pr.head.sha; - - aiCodeReview: - name: Run AI Code Review on the PR + triggerAiReview: + name: Trigger AI Review Commands runs-on: ubuntu-latest needs: getPRHead @@ -63,6 +73,27 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} UNLOAD_ENVIRONMENTS: ci + - name: Post /review command + uses: ./.github/composite/send-message + with: + prId: ${{ inputs.prId || github.event.pull_request.number }} + message: "/review" + token: ${{ env.GH_PAT }} + + - name: Post /describe command + uses: ./.github/composite/send-message + with: + prId: ${{ inputs.prId || github.event.pull_request.number }} + message: "/describe" + token: ${{ env.GH_PAT }} + + - name: Post /improve command + uses: ./.github/composite/send-message + with: + prId: ${{ inputs.prId || github.event.pull_request.number }} + message: "/improve" + token: ${{ env.GH_PAT }} + - name: Run composite workflow uses: ./.github/composite/notion-checks id: notion_check