Conversation
Available PR Commands
See: https://github.com/tahminator/codebloom/wiki/CI-Commands |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
/review |
|
/describe |
|
/improve |
|
Preparing PR description... |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| workflow_dispatch: | ||
| inputs: | ||
| prId: | ||
| description: "PR to deploy" | ||
| required: false |
There was a problem hiding this comment.
Suggestion: The prId input for the workflow_dispatch trigger is currently optional, but it is critical for the workflow to identify the target Pull Request. Without a prId, subsequent jobs and steps that rely on this identifier will fail to operate on the correct PR. Make this input required to ensure the workflow always has the necessary context. [possible issue, importance: 8]
| workflow_dispatch: | |
| inputs: | |
| prId: | |
| description: "PR to deploy" | |
| required: false | |
| workflow_dispatch: | |
| inputs: | |
| prId: | |
| description: "PR to deploy" | |
| required: true |
| pull_number: parseInt(prId, 10) | ||
| }); | ||
| return pr.head.sha; |
There was a problem hiding this comment.
Suggestion: The getPRHead job's script incorrectly assumes github.event.number or github.event.issue.number will be available for workflow_dispatch events. For workflow_dispatch, the PR ID must be retrieved from inputs.prId. Update the script to correctly use inputs.prId when triggered by workflow_dispatch to prevent failures. [possible issue, importance: 9]
New proposed code:
...
script: |
- const prId = ${{ github.event.number || github.event.issue.number }};
+ let prId;
+ if (context.eventName === 'workflow_dispatch') {
+ prId = `${{ inputs.prId }}`;
+ } else {
+ prId = `${{ github.event.number || github.event.issue.number }}`;
+ }
+ if (!prId || isNaN(parseInt(prId, 10))) {
+ throw new Error("PR ID is missing or invalid.");
+ }
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prId, 10)
});
return pr.head.sha;|
/ai |
|
/review |
|
/describe |
|
/improve |
|
Preparing PR description... |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| - 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 }} |
There was a problem hiding this comment.
Suggestion: The workflow is named AI Command Handler but unconditionally posts all three /review, /describe, and /improve commands. To truly act as a handler, add a command input to workflow_dispatch and make these steps conditional based on the provided input, allowing specific commands to be triggered. If no command is specified (e.g., on pull_request events), a default set of commands could be posted. [general, importance: 9]
| - 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 }} | |
| on: | |
| pull_request: | |
| types: [opened, 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 | |
| command: | |
| description: "The specific AI command to execute (e.g., /review, /describe, /improve)" | |
| required: false | |
| ... | |
| - name: Post /review command | |
| if: ${{ inputs.command == '/review' || (github.event_name == 'pull_request' && inputs.command == '') }} | |
| uses: ./.github/composite/send-message | |
| with: | |
| prId: ${{ inputs.prId || github.event.pull_request.number }} | |
| message: "/review" | |
| token: ${{ env.GH_PAT }} |
| @@ -38,9 +49,8 @@ jobs: | |||
| pull_number: parseInt(prId, 10) | |||
There was a problem hiding this comment.
Suggestion: The getPRHead job's script for retrieving the PR ID does not account for workflow_dispatch events. When triggered by workflow_dispatch, github.event.number and github.event.issue.number are typically null, causing the PR lookup to fail. Update the script to use inputs.prId when available to ensure correct PR identification. [possible issue, importance: 10]
New proposed code:
- const prId = ${{ github.event.number || github.event.issue.number }};
+ const prId = ${{ inputs.prId || github.event.pull_request.number || github.event.number || github.event.issue.number }};
+ if (!prId) {
+ throw new Error('PR ID not found for workflow run.');
+ }
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prId, 10)
});
801
Description of changes
Checklist before review
Screenshots
Dev
Staging