feat: add clickable issue/PR URLs to QA reports

- Add --target-url CLI option to qa-video-review.ts
- Include target URL in generated markdown reports
- Add clickable issue/PR link in deployed HTML report header
- Workflow passes the target URL automatically

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
snomiao
2026-03-24 13:42:39 +09:00
parent 5e354b118c
commit fe107d1f20
2 changed files with 37 additions and 5 deletions

View File

@@ -643,12 +643,23 @@ jobs:
- name: Run video review
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
TARGET_NUM: ${{ steps.pr.outputs.number }}
TARGET_TYPE: ${{ steps.pr.outputs.target_type }}
REPO: ${{ github.repository }}
run: |
mkdir -p video-reviews
PR_CTX_FLAG=""
if [ -f pr-context.txt ]; then
PR_CTX_FLAG="--pr-context pr-context.txt"
fi
TARGET_URL_FLAG=""
if [ -n "$TARGET_NUM" ]; then
if [ "$TARGET_TYPE" = "issue" ]; then
TARGET_URL_FLAG="--target-url https://github.com/${REPO}/issues/${TARGET_NUM}"
else
TARGET_URL_FLAG="--target-url https://github.com/${REPO}/pull/${TARGET_NUM}"
fi
fi
for vid in qa-artifacts/qa-report-*/qa-session.mp4; do
[ -f "$vid" ] || continue
DIR=$(dirname "$vid")
@@ -661,7 +672,7 @@ jobs:
--artifacts-dir qa-artifacts \
--output-dir video-reviews \
--video-file "$vid" \
--model gemini-2.5-flash $PR_CTX_FLAG $BEFORE_FLAG || true
--model gemini-2.5-flash $PR_CTX_FLAG $BEFORE_FLAG $TARGET_URL_FLAG || true
echo "::endgroup::"
done
@@ -785,12 +796,19 @@ jobs:
CARD_COUNT=$((CARD_COUNT + 1))
done
# Build commit info for the report header
# Build commit info and target link for the report header
COMMIT_HTML=""
REPO_URL="https://github.com/${REPO}"
if [ -n "$TARGET_NUM" ]; then
if [ "$TARGET_TYPE" = "issue" ]; then
COMMIT_HTML="<a href=${REPO_URL}/issues/${TARGET_NUM} class=sha title='Issue'>Issue #${TARGET_NUM}</a>"
else
COMMIT_HTML="<a href=${REPO_URL}/pull/${TARGET_NUM} class=sha title='Pull Request'>PR #${TARGET_NUM}</a>"
fi
fi
if [ -n "$BEFORE_SHA" ]; then
SHORT_BEFORE="${BEFORE_SHA:0:7}"
COMMIT_HTML="<a href=${REPO_URL}/commit/${BEFORE_SHA} class=sha title='main branch'>main @ ${SHORT_BEFORE}</a>"
COMMIT_HTML="${COMMIT_HTML:+${COMMIT_HTML} &middot; }<a href=${REPO_URL}/commit/${BEFORE_SHA} class=sha title='main branch'>main @ ${SHORT_BEFORE}</a>"
fi
if [ -n "$AFTER_SHA" ]; then
SHORT_AFTER="${AFTER_SHA:0:7}"

View File

@@ -15,6 +15,7 @@ interface CliOptions {
requestTimeoutMs: number
dryRun: boolean
prContext: string
targetUrl: string
}
interface VideoCandidate {
@@ -31,7 +32,8 @@ const DEFAULT_OPTIONS: CliOptions = {
model: 'gemini-2.5-flash',
requestTimeoutMs: 300_000,
dryRun: false,
prContext: ''
prContext: '',
targetUrl: ''
}
const USAGE = `Usage:
@@ -53,6 +55,7 @@ Options:
(default: 300000)
--pr-context <file> File with PR context (title, body, diff)
for PR-aware review
--target-url <url> Issue or PR URL to include in the report
--dry-run Discover videos and output targets only
--help Show this help text
@@ -125,6 +128,11 @@ function parseCliOptions(args: string[]): CliOptions {
continue
}
if (argument === '--target-url') {
options.targetUrl = requireValue(argument)
continue
}
if (argument === '--dry-run') {
options.dryRun = true
continue
@@ -570,6 +578,7 @@ function buildReportMarkdown(input: {
beforeVideoPath?: string
beforeVideoSizeBytes?: number
reviewText: string
targetUrl?: string
}): string {
const headerLines = [
`# ${input.platformName} QA Video Report`,
@@ -578,6 +587,10 @@ function buildReportMarkdown(input: {
`- Model: \`${input.model}\``
]
if (input.targetUrl) {
headerLines.push(`- Target: ${input.targetUrl}`)
}
if (input.beforeVideoPath) {
headerLines.push(
`- Before video: \`${toProjectRelativePath(input.beforeVideoPath)}\` (${formatBytes(input.beforeVideoSizeBytes ?? 0)})`,
@@ -650,7 +663,8 @@ async function reviewVideo(
model: options.model,
videoPath: video.videoPath,
videoSizeBytes: videoStat.size,
reviewText
reviewText,
targetUrl: options.targetUrl || undefined
}
if (beforeVideoPath) {