-
Notifications
You must be signed in to change notification settings - Fork 85
feat: dispatch centralized ocr review on PR ready #914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+58
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Dispatch Code Review | ||
|
|
||
| # Lightweight relay — on PR ready (not every push), dispatches the centralized | ||
| # ocr/Gemini review in AltimateAI/altimate-qa (code-review.yml). | ||
| # | ||
| # Gated loop: review fires only when a PR is opened non-draft or marked Ready for | ||
| # review. `synchronize` is intentionally omitted so pushes don't re-trigger. | ||
| # altimate-qa flips the PR back to draft on CRITICAL findings, so re-review happens | ||
| # on the next ready_for_review after the author addresses them. | ||
| # | ||
| # Token: reuses the org-level AUTOPILOT_DISPATCH_TOKEN (same one dbt-integration / | ||
| # vscode-dbt-power-user use to dispatch to altimate-qa). If that org secret is not | ||
| # visible to this repo, the step skips cleanly — ask an admin to extend its repo | ||
| # visibility (no new token needs to be created). | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, ready_for_review] | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: dispatch-code-review-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| dispatch: | ||
| name: Notify altimate-qa | ||
| runs-on: ubuntu-latest | ||
| if: github.event.pull_request.draft == false | ||
| timeout-minutes: 2 | ||
| steps: | ||
| - name: Dispatch to centralized code review | ||
| env: | ||
| GH_TOKEN: ${{ secrets.AUTOPILOT_DISPATCH_TOKEN }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| if [ -z "$GH_TOKEN" ]; then | ||
| echo "AUTOPILOT_DISPATCH_TOKEN not available to altimate-code — skipping centralized dispatch." | ||
| echo "Ask an org admin to extend that org secret's visibility to AltimateAI/altimate-code." | ||
| exit 0 | ||
| fi | ||
| gh api repos/AltimateAI/altimate-qa/dispatches \ | ||
| --method POST \ | ||
| -f event_type=code-review \ | ||
| -f "client_payload[repo]=AltimateAI/altimate-code" \ | ||
| -f "client_payload[pr_number]=$PR_NUMBER" \ | ||
| -f "client_payload[head_ref]=$PR_HEAD_REF" \ | ||
| -f "client_payload[head_sha]=$PR_HEAD_SHA" \ | ||
| -f "client_payload[author]=$PR_AUTHOR" \ | ||
| -f "client_payload[title]=$PR_TITLE" | ||
| echo "Dispatched code review for PR #$PR_NUMBER" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dynamic repository reference instead of hardcoded value.
The repository name is hardcoded as
AltimateAI/altimate-code. If this workflow is copied to another repository or the repository is renamed, it will send incorrect metadata to the centralized review service.♻️ Proposed fix
Use the GitHub context variable instead:
Note: This fix is included in the JSON-based approach suggested for the shell injection fix above.
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, minor. The literal
AltimateAI/altimate-codeis correct because this workflow only ever runs in this repo, but${{ github.repository }}(or$GITHUB_REPOSITORY) is cleaner and copy-paste-safe. If this PR lands, we'll switch the payload to the GitHub-provided repo context (alongside ajq-built JSON body).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dev-punia-altimate, that sounds like a solid plan — using$GITHUB_REPOSITORYtogether with ajq-built JSON body addresses both this concern and the shell-injection risk in one pass. Would you like me to open a follow-up issue to track the$GITHUB_REPOSITORY+jqpayload refactor so it doesn't get lost?