Skip to content

Add Gito PR Reviewer#47

Open
MicahZoltu wants to merge 1 commit intomainfrom
MicahZoltu-patch-1
Open

Add Gito PR Reviewer#47
MicahZoltu wants to merge 1 commit intomainfrom
MicahZoltu-patch-1

Conversation

@MicahZoltu
Copy link
Member

No description provided.

@github-actions
Copy link

I've Reviewed the Code

This PR introduces a GitHub Actions workflow for automated AI code reviews but contains a critical logic error where workflow_dispatch triggers check out the default branch instead of the specified pull request, causing incorrect analysis.

⚠️ 1 issue found across 1 file

#1 Missing PR checkout for workflow_dispatch trigger

.github/workflows/gito-code-review.yml L15-L16

When triggered via workflow_dispatch, the actions/checkout step checks out the default branch (or selected branch) rather than the Pull Request specified by the pr_number input. This causes the code review tool to analyze the wrong codebase while posting comments to the specified PR, resulting in incorrect review results. The checkout ref must be explicitly set to refs/pull//head for workflow_dispatch events.
Tags: bug, logic
Affected code:

15:       - uses: actions/checkout@v6
16:         with: { fetch-depth: 0 }

Proposed change:

      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
          ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }}

@MicahZoltu
Copy link
Member Author

Looked into the suggested change, and it appears to be incorrect. From the actions/checkout@v6 docs:

The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, uses the default branch.

So it will checkout the PR by default. Web search AI says that it will actually checkout the merge commit as if the PR were to be merged into master, which is even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant