diff --git a/.gitea/workflows/harness-replays.yml b/.gitea/workflows/harness-replays.yml index 380892fe..f26226b1 100644 --- a/.gitea/workflows/harness-replays.yml +++ b/.gitea/workflows/harness-replays.yml @@ -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"