bugraoz93 commented on code in PR #60194:
URL: https://github.com/apache/airflow/pull/60194#discussion_r2666643446
##########
.github/workflows/basic-tests.yml:
##########
@@ -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' }}
Review Comment:
```suggestion
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
```
##########
.github/workflows/basic-tests.yml:
##########
@@ -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' }}
Review Comment:
Small nit, maybe we can make the values parameterised for both `--depth` and
`--deepen` from env :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]