diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75dc5cdbace..94bf8e5141a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,10 +85,20 @@ jobs: - name: Reject accidental file deletions if: github.event_name == 'pull_request' run: node scripts/check-no-main-deletions.mjs --base origin/main + # HEAD is the PR merge ref; its first parent is the current base tip, unlike the payload's + # base.sha, which goes stale and would count the base's newer commits as the PR's changes. + - name: Find the pull request's current base + id: base + if: github.event_name == 'pull_request' + run: | + git rev-parse --verify -q HEAD^2 > /dev/null || { echo "::error::HEAD is not the pull request merge commit"; exit 1; } + sha="$(git rev-parse --verify HEAD^1)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4 id: filter with: token: "" + base: ${{ steps.base.outputs.sha }} filters: | catalog_index: - "registry/**" diff --git a/.github/workflows/player-perf.yml b/.github/workflows/player-perf.yml index f8310a70f1b..811f9a41ac5 100644 --- a/.github/workflows/player-perf.yml +++ b/.github/workflows/player-perf.yml @@ -30,10 +30,20 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 + # HEAD is the PR merge ref; its first parent is the current base tip, unlike the payload's + # base.sha, which goes stale and would count the base's newer commits as the PR's changes. + - name: Find the pull request's current base + id: base + if: github.event_name == 'pull_request' + run: | + git rev-parse --verify -q HEAD^2 > /dev/null || { echo "::error::HEAD is not the pull request merge commit"; exit 1; } + sha="$(git rev-parse --verify HEAD^1)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4 id: filter with: token: "" + base: ${{ steps.base.outputs.sha }} filters: | perf: - "packages/player/**" diff --git a/.github/workflows/preview-regression.yml b/.github/workflows/preview-regression.yml index f7666d8361f..ee66a154ead 100644 --- a/.github/workflows/preview-regression.yml +++ b/.github/workflows/preview-regression.yml @@ -29,10 +29,20 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 + # HEAD is the PR merge ref; its first parent is the current base tip, unlike the payload's + # base.sha, which goes stale and would count the base's newer commits as the PR's changes. + - name: Find the pull request's current base + id: base + if: github.event_name == 'pull_request' + run: | + git rev-parse --verify -q HEAD^2 > /dev/null || { echo "::error::HEAD is not the pull request merge commit"; exit 1; } + sha="$(git rev-parse --verify HEAD^1)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4 id: filter with: token: "" + base: ${{ steps.base.outputs.sha }} filters: | preview: - "packages/core/**" diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 5b42d5515ef..9f8832bcc3a 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -50,11 +50,21 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 + # HEAD is the PR merge ref; its first parent is the current base tip, unlike the payload's + # base.sha, which goes stale and would count the base's newer commits as the PR's changes. + - name: Find the pull request's current base + id: base + if: github.event_name == 'pull_request' + run: | + git rev-parse --verify -q HEAD^2 > /dev/null || { echo "::error::HEAD is not the pull request merge commit"; exit 1; } + sha="$(git rev-parse --verify HEAD^1)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4 id: filter if: github.event_name != 'schedule' with: token: "" + base: ${{ steps.base.outputs.sha }} filters: | code: - "packages/core/**" diff --git a/.github/workflows/windows-render.yml b/.github/workflows/windows-render.yml index 6b79739d685..7c717fab650 100644 --- a/.github/workflows/windows-render.yml +++ b/.github/workflows/windows-render.yml @@ -53,10 +53,20 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 + # HEAD is the PR merge ref; its first parent is the current base tip, unlike the payload's + # base.sha, which goes stale and would count the base's newer commits as the PR's changes. + - name: Find the pull request's current base + id: base + if: github.event_name == 'pull_request' + run: | + git rev-parse --verify -q HEAD^2 > /dev/null || { echo "::error::HEAD is not the pull request merge commit"; exit 1; } + sha="$(git rev-parse --verify HEAD^1)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4 id: filter with: token: "" + base: ${{ steps.base.outputs.sha }} # A file counts only if it matches every pattern. Player and Studio `src/` run in a browser # and no code reads a package README, so a diff confined to them skips Windows. predicate-quantifier: every