Skip to content

Apache DataFusion SQL Query Engine

chore: use shallow checkout for semver check (#26604)

Neil Conway2a96d6d621de
diff --git a/.github/workflows/breaking_changes_detector.yml b/.github/workflows/breaking_changes_detector.yml
index 8b33ca3526..187a0068a0 100644
--- a/.github/workflows/breaking_changes_detector.yml
+++ b/.github/workflows/breaking_changes_detector.yml
@@ -55,27 +55,30 @@ jobs:
name: Check semver
runs-on: ubuntu-latest
steps:
+ # The checkout is GitHub's test merge commit of the PR into the base
+ # branch. Depth 2 fetches that commit and its two parents: the base
+ # branch commit the PR was merged into, and the PR head.
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
- fetch-depth: 0
+ fetch-depth: 2
- # `origin` may point at a fork (when a contributor runs this locally) or
- # at a stale ref. Fetch the base branch from the PR's upstream repo into
- # a dedicated `apache/<base>` ref so the baseline is unambiguous and the
- # same ref name works locally (`git remote add apache ...`) and in CI.
- - name: Fetch base branch
- env:
- BASE_REF: ${{ github.base_ref }}
- REPO: ${{ github.repository }}
- run: git fetch "https://github.com/${REPO}.git" "${BASE_REF}:refs/remotes/apache/${BASE_REF}"
+ # Compare against the base branch commit the PR was merged into, not the
+ # base branch's current tip, which may include changes the PR is not
+ # built on.
+ - name: Determine base commit
+ id: base
+ run: |
+ BASE_SHA=$(git rev-parse HEAD^1)
+ echo "sha=$BASE_SHA" >> "$GITHUB_OUTPUT"
+ echo "Base commit: $BASE_SHA"
- name: Determine changed crates
id: changed_crates
env:
- BASE_REF: ${{ github.base_ref }}
+ BASE_SHA: ${{ steps.base.outputs.sha }}
run: |
- PACKAGES=$(ci/scripts/changed_crates.sh changed-crates "apache/${BASE_REF}")
+ PACKAGES=$(ci/scripts/changed_crates.sh changed-crates "$BASE_SHA")
echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"
echo "Changed crates: $PACKAGES"
@@ -97,14 +100,13 @@ jobs:
id: check_semver
if: steps.changed_crates.outputs.packages != ''
env:
- BASE_REF: ${{ github.base_ref }}
+ BASE_SHA: ${{ steps.base.outputs.sha }}
PACKAGES: ${{ steps.changed_crates.outputs.packages }}
run: |
set +e
# `tee` lets cargo's output stream live into the Actions log
# while we also keep a copy for the PR comment.
- # Using `apache` remote here to point to the repository the pull request is against
- ci/scripts/changed_crates.sh semver-check "apache/${BASE_REF}" $PACKAGES \
+ ci/scripts/changed_crates.sh semver-check "$BASE_SHA" $PACKAGES \
2>&1 | tee /tmp/semver-output.txt
EXIT_CODE=${PIPESTATUS[0]}
# Pass the result through an output instead of failing the job: