Skip to content

Commit f625881

Browse files
authored
ci: reduce checkout history footprint in PR workflows (#27221)
* ci: reduce checkout history footprint in PR workflows Optimize actions/checkout usage to avoid downloading the full repo blob history on every PR run. The repo is large, so cloning everything just to run tests wastes minutes of CI time per job. - py-operator-build-test.yml: drop fetch-depth: 0 (no history needed) - openmetadata-service-unit-tests.yml: drop fetch-depth: 0 (Sonar is explicitly skipped via -Dsonar.skip=true); shallow-fetch PR base ref - airflow-apis-tests.yml, py-tests.yml, yarn-coverage.yml: add filter: blob:none to Sonar jobs so commits/trees remain available for blame while blobs are fetched lazily on demand - ui-checkstyle.yml: add filter: blob:none to all jobs that rely on tj-actions/changed-files (needs commit/tree metadata, not blobs) * ci: drop fetch-depth: 0 from jobs that don't walk history Follow-up audit after the initial pass. Four jobs were still declaring fetch-depth: 0 (plus filter: blob:none in two cases) without actually needing any history beyond HEAD. ui-checkstyle.yml - i18n-sync: runs 'yarn i18n' then 'git status --porcelain'. git status compares the working tree to HEAD; no history walk. Default depth 1 is sufficient. - app-docs: same pattern with 'yarn generate:app-docs'. py-sonarcloud-nightly.yml - py-unit-tests: only uploads a coverage artifact, no Sonar invocation. - py-integration-tests: same. - py-combine-coverage: does run SonarSource/sonarqube-scan-action, so it genuinely needs the commit graph — added filter: blob:none for parity with the PR Sonar jobs. * ci: remove unused 'Fetch PR base branch' step from service unit tests Copilot review flagged that the step was using --depth=1 while the main checkout is also shallow, which would break any merge-base operation. On investigation, nothing downstream actually uses the base ref: the only command that runs after the checkout is 'mvn ... -Dsonar.skip=true', which has no git dependency. The step was preserved defensively in the previous commit, but it's dead code — cleanest fix is to delete it.
1 parent e410dc2 commit f625881

7 files changed

Lines changed: 12 additions & 11 deletions

.github/workflows/airflow-apis-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
with:
6262
ref: ${{ github.event.pull_request.head.sha }}
6363
fetch-depth: 0
64+
filter: blob:none
6465

6566
- name: Set up JDK 21
6667
uses: actions/setup-java@v4

.github/workflows/openmetadata-service-unit-tests.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ jobs:
7474
uses: actions/checkout@v4
7575
with:
7676
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
77-
fetch-depth: 0
78-
79-
- name: Fetch PR base branch
80-
if: ${{ github.event_name == 'pull_request' }}
81-
run: git fetch --no-tags origin ${{ github.event.pull_request.base.ref }}
8277

8378
- name: Cache Maven dependencies
8479
uses: actions/cache@v4

.github/workflows/py-operator-build-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
uses: actions/checkout@v4
6767
with:
6868
ref: ${{ github.event.pull_request.head.sha }}
69-
fetch-depth: 0
7069

7170
- name: Setup Openmetadata Test Environment
7271
uses: ./.github/actions/setup-openmetadata-test-environment

.github/workflows/py-sonarcloud-nightly.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ jobs:
4949
uses: actions/checkout@v4
5050
with:
5151
ref: ${{ env.BRANCH_NAME }}
52-
fetch-depth: 0
5352

5453
- name: Setup Openmetadata Test Environment
5554
uses: ./.github/actions/setup-openmetadata-test-environment
@@ -110,7 +109,6 @@ jobs:
110109
uses: actions/checkout@v4
111110
with:
112111
ref: ${{ env.BRANCH_NAME }}
113-
fetch-depth: 0
114112

115113
- name: Setup Openmetadata Test Environment
116114
uses: ./.github/actions/setup-openmetadata-test-environment
@@ -154,6 +152,7 @@ jobs:
154152
with:
155153
ref: ${{ env.BRANCH_NAME }}
156154
fetch-depth: 0
155+
filter: blob:none
157156

158157
- name: Setup Python
159158
uses: actions/setup-python@v5

.github/workflows/py-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ jobs:
232232
with:
233233
ref: ${{ github.event.pull_request.head.sha }}
234234
fetch-depth: 0
235+
filter: blob:none
235236

236237
- name: Setup Python
237238
uses: actions/setup-python@v5

.github/workflows/ui-checkstyle.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
with:
8585
ref: ${{ github.event.pull_request.head.sha }}
8686
fetch-depth: 0
87+
filter: blob:none
8788

8889
- uses: actions/setup-node@v4
8990
with:
@@ -194,6 +195,7 @@ jobs:
194195
with:
195196
ref: ${{ github.event.pull_request.head.sha }}
196197
fetch-depth: 0
198+
filter: blob:none
197199

198200
- uses: actions/setup-node@v4
199201
with:
@@ -377,7 +379,6 @@ jobs:
377379
- uses: actions/checkout@v4
378380
with:
379381
ref: ${{ github.event.pull_request.head.sha }}
380-
fetch-depth: 0
381382

382383
- uses: actions/setup-node@v4
383384
with:
@@ -461,7 +462,6 @@ jobs:
461462
- uses: actions/checkout@v4
462463
with:
463464
ref: ${{ github.event.pull_request.head.sha }}
464-
fetch-depth: 0
465465

466466
- uses: actions/setup-node@v4
467467
with:
@@ -546,6 +546,7 @@ jobs:
546546
with:
547547
ref: ${{ github.event.pull_request.head.sha }}
548548
fetch-depth: 0
549+
filter: blob:none
549550

550551
- uses: actions/setup-node@v4
551552
with:
@@ -654,6 +655,7 @@ jobs:
654655
with:
655656
ref: ${{ github.event.pull_request.head.sha }}
656657
fetch-depth: 0
658+
filter: blob:none
657659

658660
- uses: actions/setup-node@v4
659661
with:
@@ -755,6 +757,7 @@ jobs:
755757
with:
756758
ref: ${{ github.event.pull_request.head.sha }}
757759
fetch-depth: 0
760+
filter: blob:none
758761

759762
- uses: actions/setup-node@v4
760763
with:

.github/workflows/yarn-coverage.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ jobs:
4848
- uses: actions/checkout@v4
4949
with:
5050
ref: ${{ github.event.pull_request.head.sha }}
51-
# Disabling shallow clone is recommended for improving relevancy of reporting
51+
# Disabling shallow clone is recommended for improving relevancy of reporting.
52+
# Use partial clone (blob:none) to avoid downloading every blob in history —
53+
# commits/trees still available for Sonar blame; blobs fetched lazily as needed.
5254
fetch-depth: 0
55+
filter: blob:none
5356

5457
- name: Setup Node.js
5558
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)