Skip to content

Commit cf7fd25

Browse files
committed
fix(ci): use PR head SHA instead of merge commit SHA for Docker builds
github.sha in pull_request events is a temporary merge commit that only exists in GitHub's internal refs (refs/pull/N/merge) and is never pushed to the repo. Dockerfiles that do `git clone && git checkout ${DSTACK_REV}` fail with exit 128 because this SHA is unreachable. Use github.event.pull_request.head.sha for PR events, falling back to github.sha for push-to-branch events where it is always a real commit.
1 parent ab17d6e commit cf7fd25

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
platforms: linux/amd64
3131
provenance: false
3232
build-args: |
33-
DSTACK_REV=${{ github.sha }}
33+
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}
3434
DSTACK_SRC_URL=${{ github.server_url }}/${{ github.repository }}
3535
3636
- name: Build KMS contracts
@@ -55,7 +55,7 @@ jobs:
5555
platforms: linux/amd64
5656
provenance: false
5757
build-args: |
58-
DSTACK_REV=${{ github.sha }}
58+
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}
5959
6060
verifier:
6161
runs-on: ubuntu-latest
@@ -74,4 +74,4 @@ jobs:
7474
platforms: linux/amd64
7575
provenance: false
7676
build-args: |
77-
DSTACK_REV=${{ github.sha }}
77+
DSTACK_REV=${{ github.event.pull_request.head.sha || github.sha }}

0 commit comments

Comments
 (0)