File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 - uses : actions/checkout@v4
4444 with :
4545 submodules : true
46- # PR checkouts are merge commits; HEAD^1 is the main commit they're compared against.
46+ # PR checkouts are merge commits; HEAD^1 leads back to the main commit they're compared against.
4747 fetch-depth : 2
4848 persist-credentials : false
4949
8585 env :
8686 GH_TOKEN : ${{ github.token }}
8787 run : |
88- sha=$(git rev-parse HEAD^1)
88+ # Stacked PRs merge onto their parents' merge commits, so compare against the main commit
89+ # at the bottom of the stack rather than HEAD^1 itself.
90+ sha=$(gh api "repos/$GITHUB_REPOSITORY/compare/main...$(git rev-parse HEAD^1)" --jq .merge_base_commit.sha)
8991 latest() {
9092 gh run list -R "$GITHUB_REPOSITORY" --workflow visual.yml --branch main --event push \
9193 --commit "$sha" --limit 1 --json databaseId,status,conclusion --jq '.[0] // empty'
99101 fi
100102 if [ "$(jq -r '.conclusion // empty' <<< "$run")" = success ] &&
101103 gh run download "$(jq -r .databaseId <<< "$run")" -R "$GITHUB_REPOSITORY" -n visual-screenshots -D out/baseline; then
102- echo "Using screenshots from run $(jq -r .databaseId <<< "$run")"
104+ echo "Using screenshots from main at $sha ( run $(jq -r .databaseId <<< "$run") )"
103105 else
104106 echo "::notice::No screenshots published for main at $sha; cases are reported as new"
105107 fi
You can’t perform that action at this time.
0 commit comments