fix(harness-replays): use github.sha not branch-name as HEAD for push events
All checks were successful
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 15s
CI / Detect changes (pull_request) Successful in 52s
Harness Replays / detect-changes (pull_request) Successful in 17s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 15s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m14s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m15s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m17s
sop-tier-check / tier-check (pull_request) Successful in 22s
CI / Platform (Go) (pull_request) Successful in 11s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 8s
CI / Canvas (Next.js) (pull_request) Successful in 11s
CI / Python Lint & Test (pull_request) Successful in 9s
Harness Replays / Harness Replays (pull_request) Successful in 7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m15s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 14s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 12s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 11s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
All checks were successful
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 15s
CI / Detect changes (pull_request) Successful in 52s
Harness Replays / detect-changes (pull_request) Successful in 17s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 15s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m14s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m15s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m17s
sop-tier-check / tier-check (pull_request) Successful in 22s
CI / Platform (Go) (pull_request) Successful in 11s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 8s
CI / Canvas (Next.js) (pull_request) Successful in 11s
CI / Python Lint & Test (pull_request) Successful in 9s
Harness Replays / Harness Replays (pull_request) Successful in 7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m15s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 14s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 12s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 11s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
Root cause: PR #497 used HEAD="${GITHUB_REF#refs/heads/}" (branch name) for push events. Gitea Compare API returns empty divergent-commits when comparing a SHA (github.event.before) with a branch name (main) in a linear history — the branch IS the commit's ancestor, so there are zero divergent commits. Fix: HEAD="${{ github.sha }}" — both BASE and HEAD are SHAs, so the API returns the pushed commits' changed files. Verified: compare/{before_sha}...{current_sha} correctly returns pushed commits on a linear push. For PR events, branch names still work correctly (the Compare API handles branch-vs-branch comparisons fine). Closes regression introduced in PR #497. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
952bfb3ca2
commit
d8fc66e9bd
@ -87,20 +87,19 @@ jobs:
|
||||
# Determine base and head refs for the Compare API call.
|
||||
# Gitea Compare API accepts branch names OR commit SHAs as base/head.
|
||||
# Pull request: base.ref + head.ref are in the event payload (branch names).
|
||||
# Push: github.event.before (SHA of previous tip) as BASE, $GITHUB_REF
|
||||
# (branch name) as HEAD. These are different, so the Compare API
|
||||
# returns the actual diff — unlike the broken form which set both
|
||||
# BASE and HEAD to the same branch name, making
|
||||
# "compare/main...main" always return zero files.
|
||||
# Push: github.event.before (SHA of previous tip) as BASE, github.sha
|
||||
# (current tip SHA) as HEAD. Both SHAs means the API returns the
|
||||
# pushed commits (unlike branch-name HEAD which returns empty in
|
||||
# linear-history push events — Gitea treats SHA-vs-branch as
|
||||
# "show divergent commits" and a linear push has zero of those).
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
BASE="${{ github.event.pull_request.base.ref }}"
|
||||
HEAD="${{ github.event.pull_request.head.ref }}"
|
||||
elif [ -n "${{ github.event.before }}" ] && \
|
||||
! echo "${{ github.event.before }}" | grep -qE '^0+$'; then
|
||||
# Push event: BASE = previous tip (SHA), HEAD = current branch name.
|
||||
# Push event: BASE = previous tip (SHA), HEAD = current tip (SHA).
|
||||
BASE="${{ github.event.before }}"
|
||||
HEAD_REF="${GITHUB_REF#refs/heads/}"
|
||||
HEAD="${HEAD_REF:-main}"
|
||||
HEAD="${{ github.sha }}"
|
||||
else
|
||||
# New branch or github.event.before unavailable — run everything.
|
||||
echo "run=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user