BLOG-79 AI review bot #82

Closed
squid wants to merge 1 commits from BLOG-79_ai_review_bot into main
Owner

Description

  • Use Qudo Merge as self-hosted PR agent
  • Add a workflow that auto comment /improve command to start the agent

Package Changes

No response

Screenshots

No response

Reference

Resolves #79

Checklist

  • A milestone is set
  • The related issuse has been linked to this branch
### Description - Use Qudo Merge as self-hosted PR agent - Add a workflow that auto comment /improve command to start the agent ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #79 ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch
squid added 2 commits 2025-07-26 06:11:49 +08:00
BLOG-79 build: auto comment /improve command
Some checks failed
Frontend CI / build (push) Successful in 1m20s
PR Title Check / pr-title-check (pull_request) Failing after 13s
Auto Comment On PR / add_improve_comment (pull_request) Failing after 17s
bb9d7b3dea
BLOG-79 fix: gitea context
Some checks failed
Frontend CI / build (push) Successful in 1m8s
Auto Comment On PR / add_improve_comment (pull_request) Failing after 16s
PR Title Check / pr-title-check (pull_request) Failing after 13s
7e29ade13f
squid force-pushed BLOG-79_ai_review_bot from 7e29ade13f to e27f911757 2025-07-26 06:13:47 +08:00 Compare
squid closed this pull request 2025-07-26 06:13:54 +08:00
squid reopened this pull request 2025-07-26 06:13:56 +08:00
squid changed title from BLOG-79_ai_review_bot to BLOG-79 AI review bot 2025-07-26 06:14:17 +08:00
bot reviewed 2025-07-26 06:14:18 +08:00
bot left a comment
Collaborator

/improve

/improve
squid force-pushed BLOG-79_ai_review_bot from e27f911757 to 1c58da9b00 2025-07-26 06:20:26 +08:00 Compare
squid closed this pull request 2025-07-26 06:20:30 +08:00
squid reopened this pull request 2025-07-26 06:20:33 +08:00
squid force-pushed BLOG-79_ai_review_bot from 1c58da9b00 to 3e52617e31 2025-07-26 06:23:03 +08:00 Compare
squid closed this pull request 2025-07-26 06:23:11 +08:00
squid reopened this pull request 2025-07-26 06:23:14 +08:00
bot reviewed 2025-07-26 06:23:43 +08:00
bot left a comment
Collaborator

/improve

/improve
squid closed this pull request 2025-07-26 06:24:38 +08:00
squid reopened this pull request 2025-07-26 06:25:32 +08:00
Author
Owner

/improve

/improve
Collaborator

PR Code Suggestions

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use correct PR identifier in API URL

The Gitea API for pull request reviews expects the pull request number (index) in
the URL path, not the branch reference name. Using gitea.ref_name will result in an
incorrect API endpoint. Replace gitea.ref_name with gitea.pull_request.number to
correctly target the pull request.

.gitea/workflows/pr_agent.yaml [15-20]

-echo "Target URL: ${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.ref_name }}/reviews"
+echo "Target URL: ${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.pull_request.number }}/reviews"
 curl --fail -X POST \
   -H "Authorization: token ${{ secrets.BOT_PAT }}" \
   -H "Content-Type: application/json" \
   -d '{"body": "/improve"}' \
-  "${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.ref_name }}/reviews"
+  "${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.pull_request.number }}/reviews"
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly identifies a critical functional bug. Using gitea.ref_name instead of gitea.pull_request.number in the Gitea API URL will cause the curl command to fail, preventing the workflow from commenting on the PR.

High
## PR Code Suggestions ✨ <!-- --> <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Use correct PR identifier in API URL</summary> ___ **The Gitea API for pull request reviews expects the pull request number (index) in <br>the URL path, not the branch reference name. Using <code>gitea.ref_name</code> will result in an <br>incorrect API endpoint. Replace <code>gitea.ref_name</code> with <code>gitea.pull_request.number</code> to <br>correctly target the pull request.** [.gitea/workflows/pr_agent.yaml [15-20]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-79_ai_review_bot/.gitea/workflows/pr_agent.yaml#L15-L20) ```diff -echo "Target URL: ${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.ref_name }}/reviews" +echo "Target URL: ${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.pull_request.number }}/reviews" curl --fail -X POST \ -H "Authorization: token ${{ secrets.BOT_PAT }}" \ -H "Content-Type: application/json" \ -d '{"body": "/improve"}' \ - "${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.ref_name }}/reviews" + "${{ vars.GIT_PROVIDER_URL }}/api/v1/repos/${{ gitea.repository }}/pulls/${{ gitea.pull_request.number }}/reviews" ``` <details><summary>Suggestion importance[1-10]: 10</summary> __ Why: The suggestion correctly identifies a critical functional bug. Using `gitea.ref_name` instead of `gitea.pull_request.number` in the Gitea API URL will cause the `curl` command to fail, preventing the workflow from commenting on the PR. </details></details></td><td align=center>High </td></tr></tr></tbody></table>
squid closed this pull request 2025-07-26 06:58:03 +08:00
All checks were successful
Frontend CI / build (push) Successful in 1m5s
Required
Details
Auto Comment On PR / add_improve_comment (pull_request) Successful in 13s
PR Title Check / pr-title-check (pull_request) Successful in 17s
Required
Details

Pull request closed

Sign in to join this conversation.
No description provided.