diff --git a/.github/workflows/ai-command.yml b/.github/workflows/ai-command.yml index 470dcca0d..686c2e49a 100644 --- a/.github/workflows/ai-command.yml +++ b/.github/workflows/ai-command.yml @@ -35,10 +35,12 @@ jobs: - name: Get PR head SHA id: pr-head uses: actions/github-script@v7 + env: + PR_ID: ${{ inputs.prId }} with: result-encoding: string script: | - const prId = ${{ inputs.prId }}; + const prId = process.env.PR_ID; const { data: pr } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index 935595f24..ef4f7e688 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -3,7 +3,21 @@ run-name: Running AI code review on ${{ github.actor }}'s branch on: pull_request: - types: [opened, reopened, ready_for_review, synchronize] + types: [reopened, ready_for_review, synchronize] + 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 issue_comment: types: [created] @@ -13,7 +27,7 @@ permissions: pull-requests: write concurrency: - group: pr-ai-${{ github.event.number || github.event.issue.number }}-${{ github.event.comment.body || 'pr' }} + group: ai-command-${{ github.event.number || github.event.issue.number }} cancel-in-progress: true jobs: @@ -28,10 +42,12 @@ jobs: - name: Get PR head SHA id: pr-head uses: actions/github-script@v7 + env: + PR_ID: ${{ github.event.number || github.event.issue.number }} with: result-encoding: string script: | - const prId = ${{ github.event.number || github.event.issue.number }}; + const prId = process.env.PR_ID; const { data: pr } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, @@ -63,6 +79,27 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} UNLOAD_ENVIRONMENTS: ci + - name: Post /review command + uses: ./.github/composite/send-message + with: + prId: ${{ needs.getPRHead.outputs.prId }} + message: "/review" + token: ${{ env.GH_PAT }} + + - name: Post /describe command + uses: ./.github/composite/send-message + with: + prId: ${{ needs.getPRHead.outputs.prId }} + message: "/describe" + token: ${{ env.GH_PAT }} + + - name: Post /improve command + uses: ./.github/composite/send-message + with: + prId: ${{ needs.getPRHead.outputs.prId }} + message: "/improve" + token: ${{ env.GH_PAT }} + - name: Run composite workflow uses: ./.github/composite/notion-checks id: notion_check