Compare commits
2 Commits
cb162c154b
...
issue-120
| Author | SHA1 | Date | |
|---|---|---|---|
| db13078196 | |||
| 3ac5e5dcca |
@@ -104,6 +104,10 @@ inputs:
|
||||
description: 'Path to custom persona JSON file'
|
||||
required: false
|
||||
default: ''
|
||||
action-repo:
|
||||
description: 'Repository hosting the review-bot binary (owner/name). Defaults to rodin/review-bot on Gitea, or strat/review-bot on GitHub.'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -112,10 +116,21 @@ runs:
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||
SERVER_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
# Detect VCS type: Gitea uses /api/v1/, GitHub uses /api/v3/
|
||||
if echo "$SERVER_URL" | grep -qi 'gitea'; then
|
||||
API_BASE="${SERVER_URL}/api/v1"
|
||||
DEFAULT_ACTION_REPO="rodin/review-bot"
|
||||
else
|
||||
API_BASE="${SERVER_URL}/api/v3"
|
||||
DEFAULT_ACTION_REPO="strat/review-bot"
|
||||
fi
|
||||
ACTION_REPO="${{ inputs.action-repo || '' }}"
|
||||
if [ -z "$ACTION_REPO" ]; then
|
||||
ACTION_REPO="$DEFAULT_ACTION_REPO"
|
||||
fi
|
||||
if [ "${{ inputs.version }}" = "latest" ]; then
|
||||
VERSION=$(curl -sSf "${GITEA_URL}/api/v1/repos/${REPO}/releases?limit=1" \
|
||||
VERSION=$(curl -sSf "${API_BASE}/repos/${ACTION_REPO}/releases?limit=1" \
|
||||
| python3 -c "import sys, json; releases = json.load(sys.stdin); print(releases[0]['tag_name'] if releases else '')")
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Failed to determine latest version" >&2
|
||||
@@ -125,6 +140,8 @@ runs:
|
||||
VERSION="${{ inputs.version }}"
|
||||
fi
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "action-repo=${ACTION_REPO}" >> "$GITHUB_OUTPUT"
|
||||
echo "server-url=${SERVER_URL}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache review-bot binary
|
||||
id: cache
|
||||
@@ -137,14 +154,14 @@ runs:
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||
SERVER_URL="${{ steps.version.outputs.server-url }}"
|
||||
ACTION_REPO="${{ steps.version.outputs.action-repo }}"
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
BINARY="review-bot-linux-amd64"
|
||||
|
||||
curl -sSfL "${GITEA_URL}/${REPO}/releases/download/${VERSION}/${BINARY}" \
|
||||
curl -sSfL "${SERVER_URL}/${ACTION_REPO}/releases/download/${VERSION}/${BINARY}" \
|
||||
-o "${{ runner.temp }}/review-bot"
|
||||
curl -sSfL "${GITEA_URL}/${REPO}/releases/download/${VERSION}/checksums.txt" \
|
||||
curl -sSfL "${SERVER_URL}/${ACTION_REPO}/releases/download/${VERSION}/checksums.txt" \
|
||||
-o "${{ runner.temp }}/checksums.txt"
|
||||
|
||||
# Verify SHA-256 checksum
|
||||
@@ -169,8 +186,8 @@ runs:
|
||||
- name: Run review
|
||||
shell: bash
|
||||
env:
|
||||
GITEA_URL: ${{ inputs.gitea-url || github.server_url }}
|
||||
GITEA_REPO: ${{ inputs.repo || github.repository }}
|
||||
GITHUB_SERVER_URL: ${{ inputs.gitea-url || github.server_url }}
|
||||
GITHUB_REPOSITORY: ${{ inputs.repo || github.repository }}
|
||||
PR_NUMBER: ${{ inputs.pr-number || github.event.pull_request.number }}
|
||||
REVIEWER_TOKEN: ${{ inputs.reviewer-token }}
|
||||
REVIEWER_NAME: ${{ inputs.reviewer-name }}
|
||||
|
||||
@@ -104,6 +104,10 @@ inputs:
|
||||
description: 'Path to custom persona JSON file'
|
||||
required: false
|
||||
default: ''
|
||||
action-repo:
|
||||
description: 'Repository hosting the review-bot binary (owner/name). Defaults to rodin/review-bot on Gitea, or strat/review-bot on GitHub.'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -112,10 +116,21 @@ runs:
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||
SERVER_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
# Detect VCS type: Gitea uses /api/v1/, GitHub uses /api/v3/
|
||||
if echo "$SERVER_URL" | grep -qi 'gitea'; then
|
||||
API_BASE="${SERVER_URL}/api/v1"
|
||||
DEFAULT_ACTION_REPO="rodin/review-bot"
|
||||
else
|
||||
API_BASE="${SERVER_URL}/api/v3"
|
||||
DEFAULT_ACTION_REPO="strat/review-bot"
|
||||
fi
|
||||
ACTION_REPO="${{ inputs.action-repo || '' }}"
|
||||
if [ -z "$ACTION_REPO" ]; then
|
||||
ACTION_REPO="$DEFAULT_ACTION_REPO"
|
||||
fi
|
||||
if [ "${{ inputs.version }}" = "latest" ]; then
|
||||
VERSION=$(curl -sSf "${GITEA_URL}/api/v1/repos/${REPO}/releases?limit=1" \
|
||||
VERSION=$(curl -sSf "${API_BASE}/repos/${ACTION_REPO}/releases?limit=1" \
|
||||
| python3 -c "import sys, json; releases = json.load(sys.stdin); print(releases[0]['tag_name'] if releases else '')")
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Failed to determine latest version" >&2
|
||||
@@ -125,6 +140,8 @@ runs:
|
||||
VERSION="${{ inputs.version }}"
|
||||
fi
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "action-repo=${ACTION_REPO}" >> "$GITHUB_OUTPUT"
|
||||
echo "server-url=${SERVER_URL}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache review-bot binary
|
||||
id: cache
|
||||
@@ -137,14 +154,14 @@ runs:
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
GITEA_URL="${{ inputs.gitea-url || github.server_url }}"
|
||||
REPO="${{ inputs.repo || 'rodin/review-bot' }}"
|
||||
SERVER_URL="${{ steps.version.outputs.server-url }}"
|
||||
ACTION_REPO="${{ steps.version.outputs.action-repo }}"
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
BINARY="review-bot-linux-amd64"
|
||||
|
||||
curl -sSfL "${GITEA_URL}/${REPO}/releases/download/${VERSION}/${BINARY}" \
|
||||
curl -sSfL "${SERVER_URL}/${ACTION_REPO}/releases/download/${VERSION}/${BINARY}" \
|
||||
-o "${{ runner.temp }}/review-bot"
|
||||
curl -sSfL "${GITEA_URL}/${REPO}/releases/download/${VERSION}/checksums.txt" \
|
||||
curl -sSfL "${SERVER_URL}/${ACTION_REPO}/releases/download/${VERSION}/checksums.txt" \
|
||||
-o "${{ runner.temp }}/checksums.txt"
|
||||
|
||||
# Verify SHA-256 checksum
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Self-review workflow for strat/review-bot on GitHub Enterprise Server.
|
||||
# Tests that the composite action runs correctly on GitHub runners:
|
||||
# - GITHUB_SERVER_URL and GITHUB_REPOSITORY env vars are set correctly
|
||||
# - Binary is downloaded from gitea.weiker.me (where releases live)
|
||||
# - Review is posted to the corresponding Gitea PR
|
||||
name: Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.event_name == 'pull_request'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- name: sonnet
|
||||
token_secret: SONNET_REVIEW_TOKEN
|
||||
model: anthropic--claude-4.6-sonnet
|
||||
- name: gpt
|
||||
token_secret: GPT_REVIEW_TOKEN
|
||||
model: gpt-5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run ${{ matrix.name }} review
|
||||
uses: ./.gitea/actions/review
|
||||
with:
|
||||
# Download binary from Gitea (releases live there, not on GHE)
|
||||
gitea-url: https://gitea.weiker.me
|
||||
# Post review to the corresponding Gitea repo
|
||||
repo: rodin/review-bot
|
||||
reviewer-token: ${{ secrets[matrix.token_secret] }}
|
||||
reviewer-name: ${{ matrix.name }}
|
||||
llm-model: ${{ matrix.model }}
|
||||
llm-provider: aicore
|
||||
aicore-client-id: ${{ secrets.AICORE_CLIENT_ID }}
|
||||
aicore-client-secret: ${{ secrets.AICORE_CLIENT_SECRET }}
|
||||
aicore-auth-url: ${{ secrets.AICORE_AUTH_URL }}
|
||||
aicore-api-url: ${{ secrets.AICORE_API_URL }}
|
||||
aicore-resource-group: ${{ secrets.AICORE_RESOURCE_GROUP }}
|
||||
conventions-file: CONVENTIONS.md
|
||||
patterns-repo: rodin/go-patterns
|
||||
patterns-files: 'README.md,patterns/'
|
||||
dry-run: 'true'
|
||||
timeout: '600'
|
||||
Reference in New Issue
Block a user