From 0a16989d261d0dda2c9b206c333078e3e0e2994d Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 28 Mar 2022 08:17:04 -0400 Subject: [PATCH] Fix unexpected coverage diffs for PRs that aren't up to date (#8161) --- .github/workflows/test_coverage.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index 292b8a9865..6eb4d883bd 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -12,6 +12,11 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + with: + # If this is a pull request, make sure we check out its head rather than the + # automatically generated merge commit, so that the coverage diff excludes + # unrelated changes in the base branch + ref: ${{ github.event.type == 'PullRequestEvent' && github.event.pull_request.head.sha || '' }} - name: Yarn cache uses: c-hive/gha-yarn-cache@v2