Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,40 @@ jobs:
python-version: ${{ steps.breeze.outputs.host-python-version }}
platform: ${{ inputs.platform }}
save-cache: true
- name: Fetch incoming commit ${{ github.sha }} with its parent
- name: Fetch incoming commit ${{ github.sha }} with history
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.sha }}
fetch-depth: 2
fetch-depth: 50
persist-credentials: false
- name: Calculate merge-base for PR
id: merge-base
run: |
git fetch origin "$BASE_BRANCH" --depth=50

# Try to find merge-base, deepen if not found
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD 2>/dev/null || echo "")

if [ -z "$MERGE_BASE" ]; then
echo "Merge-base not found with depth=50, fetching more history..."
git fetch --deepen=450
git fetch origin "$BASE_BRANCH" --deepen=450
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD)
fi

echo "sha=${MERGE_BASE}" >> $GITHUB_OUTPUT
env:
BASE_BRANCH: ${{ github.base_ref || 'main' }}
Comment on lines +231 to +245
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git fetch origin "$BASE_BRANCH" --depth=50
# Try to find merge-base, deepen if not found
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD 2>/dev/null || echo "")
if [ -z "$MERGE_BASE" ]; then
echo "Merge-base not found with depth=50, fetching more history..."
git fetch --deepen=450
git fetch origin "$BASE_BRANCH" --deepen=450
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD)
fi
echo "sha=${MERGE_BASE}" >> $GITHUB_OUTPUT
env:
BASE_BRANCH: ${{ github.base_ref || 'main' }}
git fetch origin "$BASE_BRANCH" --depth=$FETCH_DEPTH
# Try to find merge-base, deepen if not found
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD 2>/dev/null || echo "")
if [ -z "$MERGE_BASE" ]; then
echo "Merge-base not found with depth=$FETCH_DEPTH, fetching more history..."
git fetch --deepen=$DEEPEN
git fetch origin "$BASE_BRANCH" --deepen=$DEEPEN
MERGE_BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD)
fi
echo "sha=${MERGE_BASE}" >> $GITHUB_OUTPUT
env:
BASE_BRANCH: ${{ github.base_ref || 'main' }}
FETCH_DEPTH: 50
DEEPEN: 450

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, maybe we can make the values parameterised for both --depth and --deepen from env :)

- name: "Static checks: basic checks only"
run: >
prek --show-diff-on-failure --color always
--from-ref "${{ github.sha }}" --to-ref "${{ github.sha }}"
--from-ref "${MERGE_BASE}" --to-ref "HEAD"
env:
VERBOSE: "false"
SKIP_BREEZE_PREK_HOOKS: "true"
SKIP: ${{ inputs.skip-prek-hooks }}
COLUMNS: "202"
MERGE_BASE: ${{ steps.merge-base.outputs.sha }}

test-git-clone-on-windows:
timeout-minutes: 5
Expand Down
Loading