Skip to content

Commit e99b6ff

Browse files
authored
ci(build-and-test-differential): fetch only necessary commits (autowarefoundation#7468)
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
1 parent d532672 commit e99b6ff

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/build-and-test-differential-arm64.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ jobs:
3232
container: ghcr.io/autowarefoundation/autoware:latest-prebuilt
3333
build-depends-repos: build_depends.repos
3434
steps:
35-
- name: Check out repository
35+
- name: Set PR fetch depth
36+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
37+
38+
- name: Checkout PR branch and all PR commits
3639
uses: actions/checkout@v4
3740
with:
38-
fetch-depth: 0
41+
ref: ${{ github.event.pull_request.head.sha }}
42+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
3943

4044
- name: Show disk space before the tasks
4145
run: df -h

.github/workflows/build-and-test-differential.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ jobs:
3131
container: ghcr.io/autowarefoundation/autoware:latest-prebuilt
3232
build-depends-repos: build_depends.repos
3333
steps:
34-
- name: Check out repository
34+
- name: Set PR fetch depth
35+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
36+
37+
- name: Checkout PR branch and all PR commits
3538
uses: actions/checkout@v4
3639
with:
37-
fetch-depth: 0
40+
ref: ${{ github.event.pull_request.head.sha }}
41+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
3842

3943
- name: Show disk space before the tasks
4044
run: df -h

0 commit comments

Comments
 (0)