Skip to content

Commit 2a86306

Browse files
committed
ci: use fork clone_url for DSTACK_SRC_URL on PRs from forks
When a PR comes from a fork, the head SHA doesn't exist in the base repo yet, so `git clone <base> && git checkout <head-sha>` inside the Docker builder fails with "unable to read tree". Pick the head repo's clone_url when it's available, and fall back to the base repo URL for push events.
1 parent 282eeb2 commit 2a86306

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/docker-build-check.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
build-shared=build/shared
3232
build-args: |
3333
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}
34-
DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}
34+
DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}
3535
3636
- name: Verify pinned packages
3737
run: |
@@ -47,7 +47,7 @@ jobs:
4747
--provenance=false \
4848
--build-context build-shared=build/shared \
4949
--build-arg "DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}" \
50-
--build-arg "DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}" \
50+
--build-arg "DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}" \
5151
gateway/dstack-app/builder
5252
5353
- name: Verify builder pinned packages
@@ -75,7 +75,7 @@ jobs:
7575
build-shared=build/shared
7676
build-args: |
7777
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}
78-
DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}
78+
DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}
7979
8080
- name: Verify pinned packages (qemu stage)
8181
run: |
@@ -91,7 +91,7 @@ jobs:
9191
--provenance=false \
9292
--build-context build-shared=build/shared \
9393
--build-arg "DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}" \
94-
--build-arg "DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}" \
94+
--build-arg "DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}" \
9595
kms/dstack-app/builder
9696
9797
- name: Verify builder pinned packages
@@ -126,7 +126,7 @@ jobs:
126126
build-shared=build/shared
127127
build-args: |
128128
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}
129-
DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}
129+
DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}
130130
131131
- name: Verify pinned packages (runtime)
132132
run: |
@@ -143,7 +143,7 @@ jobs:
143143
--file verifier/builder/Dockerfile \
144144
--build-context build-shared=build/shared \
145145
--build-arg "DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}" \
146-
--build-arg "DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}" \
146+
--build-arg "DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}" \
147147
verifier
148148
149149
- name: Verify builder pinned packages
@@ -161,7 +161,7 @@ jobs:
161161
--file verifier/builder/Dockerfile \
162162
--build-context build-shared=build/shared \
163163
--build-arg "DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}" \
164-
--build-arg "DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}" \
164+
--build-arg "DSTACK_SRC_URL=${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}" \
165165
verifier
166166
167167
- name: Verify qemu pinned packages

0 commit comments

Comments
 (0)