chore: import upstream snapshot with attribution
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# Determine whether to do incremental or full review based on event context
|
||||
# Outputs: scope, base_sha, head_sha to GITHUB_OUTPUT
|
||||
#
|
||||
# Required environment variables:
|
||||
# EVENT_ACTION - GitHub event action (opened, synchronize, ready_for_review)
|
||||
# EVENT_BEFORE - SHA before synchronize event
|
||||
# EVENT_AFTER - SHA after synchronize event
|
||||
# PR_BASE_SHA - PR base branch SHA
|
||||
# PR_HEAD_SHA - PR head SHA
|
||||
# GITHUB_OUTPUT - GitHub Actions output file
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Validate SHA format (40 hex chars, not null SHA) and verify it exists
|
||||
is_valid_sha() {
|
||||
local sha="$1"
|
||||
[[ "$sha" =~ ^[0-9a-f]{40}$ ]] &&
|
||||
[[ "$sha" != "0000000000000000000000000000000000000000" ]] &&
|
||||
git rev-parse --verify "$sha^{commit}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Check if a commit is a merge commit (has 2+ parents)
|
||||
# Used to detect "merge main into branch" which should trigger full review
|
||||
is_merge_commit() {
|
||||
local sha="$1"
|
||||
git rev-parse --verify "$sha^2" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# For synchronize events with valid SHAs and no merge commits, do incremental review
|
||||
# Merge commits (e.g., merging main into branch) trigger full review to avoid
|
||||
# reviewing main branch changes that aren't part of this PR
|
||||
if [ "$EVENT_ACTION" = "synchronize" ] &&
|
||||
is_valid_sha "$EVENT_BEFORE" &&
|
||||
is_valid_sha "$EVENT_AFTER" &&
|
||||
! is_merge_commit "$EVENT_AFTER"; then
|
||||
{
|
||||
echo "scope=incremental"
|
||||
echo "base_sha=$EVENT_BEFORE"
|
||||
echo "head_sha=$EVENT_AFTER"
|
||||
} >>"$GITHUB_OUTPUT"
|
||||
else
|
||||
# Full review for: opened, ready_for_review, force push, or merge commits
|
||||
{
|
||||
echo "scope=full"
|
||||
echo "base_sha=$PR_BASE_SHA"
|
||||
echo "head_sha=$PR_HEAD_SHA"
|
||||
} >>"$GITHUB_OUTPUT"
|
||||
fi
|
||||
Reference in New Issue
Block a user