fix: address PR #75 review findings
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 18s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 39s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m32s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 3m18s
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 18s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 39s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 1m32s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 3m18s
MAJOR fixes: - ci.yml: Add fork protection (github.event.pull_request.head.repo.full_name check) to prevent secret exfiltration from malicious fork PRs. Added security comment explaining the trust model for this private repo. - ci.yml: Set GITHUB_SERVER_URL to explicit Gitea URL instead of github.server_url since reviews are posted to Gitea, not GitHub. - release.yml: Set GITEA_URL explicitly to https://gitea.weiker.me since releases are created on Gitea. - action.yml: Change gitea-url default from empty (fallback to github.server_url) to explicit https://gitea.weiker.me. Update all internal uses to rely on this default rather than falling back to server_url. MINOR fixes: - action.yml: Update header comment to reflect dual-platform (Gitea Actions + GitHub Actions) support. - action.yml: Fix repo input description to say it defaults to rodin/review-bot for version lookup, matching the actual code behavior. - pr-ready-gate.yml: Add comments explaining why Gitea URL is hardcoded (intentional: we update Gitea PR from GitHub mirror) and noting the PR number matching assumption. All findings from sonnet-review, gpt-review, and security-review addressed.
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
# This composite action is designed for Gitea Actions runners.
|
# Composite action for Gitea Actions and GitHub Actions runners.
|
||||||
# Gitea Actions supports GitHub Actions syntax including $GITHUB_OUTPUT,
|
# Supports dual-platform deployment: reviews can be triggered from GitHub (mirrored repo)
|
||||||
# actions/cache, and actions/checkout.
|
# or Gitea, but always post results to the Gitea PR.
|
||||||
# Requirements: python3, sha256sum, curl (all present on ubuntu-* runners).
|
# Requirements: python3, sha256sum, curl (all present on ubuntu-* runners).
|
||||||
name: 'AI Code Review'
|
name: 'AI Code Review'
|
||||||
description: 'Run AI-powered code review on a pull request using review-bot'
|
description: 'Run AI-powered code review on a pull request using review-bot'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
gitea-url:
|
gitea-url:
|
||||||
description: 'Gitea instance URL (defaults to server_url)'
|
description: 'Gitea instance URL for API calls and releases (defaults to https://gitea.weiker.me)'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: 'https://gitea.weiker.me'
|
||||||
repo:
|
repo:
|
||||||
description: 'Repository (owner/name, defaults to current)'
|
description: 'Repository (owner/name, defaults to rodin/review-bot for version lookup)'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
pr-number:
|
pr-number:
|
||||||
@@ -112,7 +112,8 @@ runs:
|
|||||||
id: version
|
id: version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
# Use explicit gitea-url input, falling back to default (https://gitea.weiker.me)
|
||||||
|
GITEA_URL="${{ inputs.gitea-url }}"
|
||||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||||
if [ "${{ inputs.version }}" = "latest" ]; then
|
if [ "${{ inputs.version }}" = "latest" ]; then
|
||||||
VERSION=$(curl -sSf "${GITEA_URL}/api/v1/repos/${REPO}/releases?limit=1" \
|
VERSION=$(curl -sSf "${GITEA_URL}/api/v1/repos/${REPO}/releases?limit=1" \
|
||||||
@@ -137,7 +138,8 @@ runs:
|
|||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
# Use explicit gitea-url input for release downloads
|
||||||
|
GITEA_URL="${{ inputs.gitea-url }}"
|
||||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
BINARY="review-bot-linux-amd64"
|
BINARY="review-bot-linux-amd64"
|
||||||
@@ -169,7 +171,8 @@ runs:
|
|||||||
- name: Run review
|
- name: Run review
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITHUB_SERVER_URL: ${{ inputs.gitea-url || github.server_url }}
|
# Always use Gitea API - reviews are posted to Gitea regardless of where workflow runs
|
||||||
|
GITHUB_SERVER_URL: ${{ inputs.gitea-url }}
|
||||||
GITHUB_REPOSITORY: ${{ inputs.repo || github.repository }}
|
GITHUB_REPOSITORY: ${{ inputs.repo || github.repository }}
|
||||||
PR_NUMBER: ${{ inputs.pr-number || github.event.pull_request.number }}
|
PR_NUMBER: ${{ inputs.pr-number || github.event.pull_request.number }}
|
||||||
REVIEWER_TOKEN: ${{ inputs.reviewer-token }}
|
REVIEWER_TOKEN: ${{ inputs.reviewer-token }}
|
||||||
|
|||||||
@@ -22,9 +22,13 @@ jobs:
|
|||||||
# Models must match SAP AI Core deployments
|
# Models must match SAP AI Core deployments
|
||||||
# Available models: gpt-5, anthropic--claude-4.6-sonnet, anthropic--claude-4.6-opus
|
# Available models: gpt-5, anthropic--claude-4.6-sonnet, anthropic--claude-4.6-opus
|
||||||
# Removed gpt-4.1, gpt-5-mini, gpt-4.1-mini - not deployed on AI Core
|
# Removed gpt-4.1, gpt-5-mini, gpt-4.1-mini - not deployed on AI Core
|
||||||
|
#
|
||||||
|
# SECURITY: This job runs on pull_request and has access to secrets.
|
||||||
|
# We restrict to same-repo PRs only (no forks) since this is a private repo
|
||||||
|
# where PRs only come from trusted actors (rodin/aweiker).
|
||||||
review:
|
review:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||||
needs: test
|
needs: test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -49,8 +53,9 @@ jobs:
|
|||||||
- run: go build -o review-bot ./cmd/review-bot
|
- run: go build -o review-bot ./cmd/review-bot
|
||||||
- name: Run ${{ matrix.name }} review
|
- name: Run ${{ matrix.name }} review
|
||||||
env:
|
env:
|
||||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
# Use Gitea API - reviews are posted to Gitea, not GitHub
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_SERVER_URL: https://gitea.weiker.me
|
||||||
|
GITHUB_REPOSITORY: rodin/review-bot
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
REVIEWER_TOKEN: ${{ secrets[matrix.token_secret] }}
|
REVIEWER_TOKEN: ${{ secrets[matrix.token_secret] }}
|
||||||
REVIEWER_NAME: ${{ matrix.name }}
|
REVIEWER_NAME: ${{ matrix.name }}
|
||||||
|
|||||||
@@ -13,11 +13,16 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.RODIN_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.RODIN_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# NOTE: This workflow runs on the GitHub mirror but updates the Gitea PR.
|
||||||
|
# PR numbers may differ between GitHub and Gitea mirrors in edge cases.
|
||||||
|
# For this repo, PRs are created on Gitea and mirrored, so numbers match.
|
||||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||||
AUTHOR=${{ github.event.pull_request.user.login }}
|
AUTHOR=${{ github.event.pull_request.user.login }}
|
||||||
READY_LABEL_ID=38
|
READY_LABEL_ID=38
|
||||||
SELF_REVIEWED_LABEL_ID=37
|
SELF_REVIEWED_LABEL_ID=37
|
||||||
|
|
||||||
|
# INTENTIONAL: Hardcoded Gitea URL because we always update the Gitea PR,
|
||||||
|
# not GitHub. The mirror relationship means we want changes on Gitea.
|
||||||
# Remove ready label if present
|
# Remove ready label if present
|
||||||
curl -sS -X DELETE \
|
curl -sS -X DELETE \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
VERSION=${GITHUB_REF_NAME}
|
VERSION=${GITHUB_REF_NAME}
|
||||||
GITEA_URL="${{ github.server_url }}"
|
# Releases are created on Gitea, not GitHub - use explicit Gitea URL
|
||||||
REPO="${{ github.repository }}"
|
GITEA_URL="https://gitea.weiker.me"
|
||||||
|
REPO="rodin/review-bot"
|
||||||
|
|
||||||
# Create release (or find existing one for this tag)
|
# Create release (or find existing one for this tag)
|
||||||
HTTP_CODE=$(curl -s -o /tmp/release_response.json -w "%{http_code}" -X POST \
|
HTTP_CODE=$(curl -s -o /tmp/release_response.json -w "%{http_code}" -X POST \
|
||||||
|
|||||||
Reference in New Issue
Block a user