Skip to content

Commit 1dc06fe

Browse files
committed
ci: trigger publish-test-deps-image on PR Dockerfile changes
Adds pull_request_target trigger so a Dockerfile change in a PR republishes :bookworm without waiting for merge to master. Uses the PR head SHA in checkout so the build sees the PR's Dockerfile. Concurrency now scoped per-PR/branch to keep parallel pushes from racing to overwrite the tag.
1 parent 9ad3a21 commit 1dc06fe

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/publish-test-deps-image.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,31 @@ name: Publish test-deps image
33
# Builds docker/wolfprovider-test-deps/Dockerfile and pushes it to
44
# ghcr.io/wolfssl/wolfprovider-test-deps:bookworm.
55
#
6-
# Fires when the Dockerfile (or this workflow file) changes on master.
7-
# The pushed package stays private -- consumer workflows running on
8-
# wolfSSL/wolfProvider use the canonical GITHUB_TOKEN, which has read
9-
# access to the org's private packages.
6+
# Triggers:
7+
# - push to master/main when the Dockerfile changes -> rebuilds :bookworm
8+
# - pull_request_target when the Dockerfile changes -> rebuilds :bookworm
9+
# from the PR head SHA, so PR jobs that consume the image (sanitizers,
10+
# static-analysis, multi-compiler, OSP) actually see the updated deps.
11+
# pull_request_target runs from BASE with canonical secrets, so the
12+
# ghcr push has the right scope; checkout pins to the PR head SHA so
13+
# the build sees the PR's Dockerfile.
14+
# - workflow_dispatch for manual rebuilds
1015

1116
on:
1217
push:
1318
branches: [ 'master', 'main' ]
1419
paths:
1520
- 'docker/wolfprovider-test-deps/**'
1621
- '.github/workflows/publish-test-deps-image.yml'
22+
pull_request_target:
23+
paths:
24+
- 'docker/wolfprovider-test-deps/**'
25+
- '.github/workflows/publish-test-deps-image.yml'
1726
workflow_dispatch: {}
1827

1928
concurrency:
20-
group: publish-test-deps-image
29+
# Serialize per-PR/branch so two pushes don't race to overwrite :bookworm.
30+
group: publish-test-deps-image-${{ github.event.pull_request.number || github.ref }}
2131
cancel-in-progress: false
2232

2333
permissions:
@@ -26,14 +36,16 @@ permissions:
2636

2737
jobs:
2838
publish:
29-
# Only the canonical repo's runner has a token authorized to push
30-
# to ghcr.io/wolfssl/*. Forks won't have that scope, so skip.
39+
# Canonical repo only - forks lack the ghcr push scope.
3140
if: github.repository == 'wolfSSL/wolfProvider'
3241
runs-on: ubuntu-22.04
3342
timeout-minutes: 45
3443
steps:
3544
- uses: actions/checkout@v4
3645
with:
46+
# For pull_request_target, default checkout pulls BASE. We need
47+
# the PR head SHA so the build sees the PR's Dockerfile.
48+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3749
fetch-depth: 1
3850

3951
- name: Set up Docker Buildx

0 commit comments

Comments
 (0)