diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2143d391061..db819ccc4ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,8 +225,8 @@ jobs: if: github.ref != 'refs/heads/master' steps: # See https://github.com/actions/checkout/issues/552#issuecomment-1167086216 - - name: "PR commits + 1" - run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" + - name: "PR commits" + run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} ))" >> "${GITHUB_ENV}" - name: "Checkout PR branch and all PR commits" uses: actions/checkout@v4 @@ -235,10 +235,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} fetch-depth: ${{ env.PR_FETCH_DEPTH }} - - name: "Fetch the other branch with enough history for a common merge-base commit" - run: | - git fetch origin ${{ github.event.pull_request.base.ref }} - - name: Check for fixups run: | ./scripts/check_for_fixups.sh ${{ github.event.pull_request.base.ref }} diff --git a/scripts/check_for_fixups.sh b/scripts/check_for_fixups.sh index 31ed8640e31..3d5518360f3 100755 --- a/scripts/check_for_fixups.sh +++ b/scripts/check_for_fixups.sh @@ -1,19 +1,8 @@ #!/bin/sh -base_ref=$1 - -# Determine the base commit -base_commit=$(git merge-base HEAD origin/"$base_ref") - -# Check if base_commit is set correctly -if [ -z "$base_commit" ]; then - echo "Failed to determine base commit." - exit 1 -fi -echo "Base commit: $base_commit" - -# Get commits with "fixup!" in the message from base_commit to HEAD -commits=$(git log -i -E --grep '^fixup!' --grep '^squash!' --grep '^amend!' --grep '^[^\n]*WIP' --grep '^[^\n]*DROPME' --format="%h %s" "$base_commit..HEAD") +# We will have only done a shallow clone, so the git log will consist only of +# commits on the current PR +commits=$(git log --grep='^fixup!' --grep='^squash!' --grep='^amend!' --grep='^[^\n]*WIP' --grep='^[^\n]*DROPME' --format="%h %s") if [ -z "$commits" ]; then echo "No fixup commits found."