From cff4f4988fb349c2479f8e87731016b9c5ac9240 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 10:19:52 +1100 Subject: [PATCH 1/9] Attempting to ensure PR comments build the branch and not repo default --- .github/workflows/build-deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 109e51b0..62996304 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -57,6 +57,7 @@ jobs: with: images: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }} + context: ${{ github.event.issue.pull_request && 'workflow' || 'git' }} tags: | # PR images (not merged): pr- type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }} @@ -71,7 +72,8 @@ jobs: type=raw,value=6.x,enable=${{ github.ref == 'refs/heads/6.x' || github.event.pull_request.base.ref == '6.x' }} type=raw,value=7.x,enable=${{ github.ref == 'refs/heads/7.x' || github.event.pull_request.base.ref == '7.x' }} # Always add an immutable sha tag - type=raw,value=sha-${{ github.sha }} + type=raw,value=sha-${{ github.event.issue.pull_request && 'manual' || github.sha }},enable=false + type=raw,value=sha-${{ github.event.pull_request.head.sha || github.sha }},enable=${{ github.event_name == 'pull_request' || github.event.issue.pull_request != null }} labels: | maintainer=Digital Victoria repository=${{ github.repositoryUrl }} From ae4024dbcb58a4af5970dba211b3f121c85d1846 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 10:24:51 +1100 Subject: [PATCH 2/9] Replaced "Digital Victoria" in image labels --- .github/workflows/build-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 62996304..caa00a31 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -75,9 +75,9 @@ jobs: type=raw,value=sha-${{ github.event.issue.pull_request && 'manual' || github.sha }},enable=false type=raw,value=sha-${{ github.event.pull_request.head.sha || github.sha }},enable=${{ github.event_name == 'pull_request' || github.event.issue.pull_request != null }} labels: | - maintainer=Digital Victoria + maintainer=Victorian Department of Government Services repository=${{ github.repositoryUrl }} - org.opencontainers.image.authors=Digital Victoria + org.opencontainers.image.authors=Victorian Department of Government Services org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ (contains(fromJson('["opened","synchronize"]'), github.event.action)) && github.head_ref || github.event.action == 'closed' && github.base_ref || github.ref_name }}/images/${{ matrix.images }}/Dockerfile org.opencontainers.image.title=${{ matrix.images }} org.opencontainers.image.description=${{ matrix.images }} image for Bay container platform From 4f7e5e63b7119a8ca810be9efdff7062b9134834 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 10:26:35 +1100 Subject: [PATCH 3/9] Test comment in assets so we can test correct branch is used --- images/php/settings.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/images/php/settings.php b/images/php/settings.php index 36897eb4..cdd0b677 100755 --- a/images/php/settings.php +++ b/images/php/settings.php @@ -436,3 +436,5 @@ $config['environment_indicator.indicator']['name'] = "Deployed: $label"; } } + +// Test comment SDPPE-91 \ No newline at end of file From a1f3f8832cb6e0116d45531de8355eed232f2edf Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 10:53:29 +1100 Subject: [PATCH 4/9] Explicitly define bake action source --- .github/workflows/build-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index caa00a31..08bd10b9 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -103,6 +103,7 @@ jobs: uses: docker/bake-action@v5 with: push: true + source: . files: | ./gh-actions-bake.hcl ${{ steps.meta.outputs.bake-file }} From a288b4e8694c394ec1064e689df0d7a13cd67f18 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 11:15:08 +1100 Subject: [PATCH 5/9] Update tag logic to use xt0rted/pull-request-comment-branch action --- .github/workflows/build-deploy.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 08bd10b9..c92b636b 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -27,6 +27,11 @@ jobs: matrix: images: ${{ fromJson(vars.IMAGES) }} steps: + - name: Get PR branch + if: github.event.issue.pull_request + id: pr-branch + uses: xt0rted/pull-request-comment-branch@v3 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -63,17 +68,16 @@ jobs: type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }} # Tag with the PR base branch name on merge type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }} - # Manual/scheduled runs tag by branch ref (for whichever release branch the run targets) + # Manual/scheduled runs tag by branch ref type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }} # Comment-triggered builds: pr- - type=raw,event=default,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }} - # Supported release branches - type=raw,value=5.x,enable=${{ github.ref == 'refs/heads/5.x' || github.event.pull_request.base.ref == '5.x' }} - type=raw,value=6.x,enable=${{ github.ref == 'refs/heads/6.x' || github.event.pull_request.base.ref == '6.x' }} - type=raw,value=7.x,enable=${{ github.ref == 'refs/heads/7.x' || github.event.pull_request.base.ref == '7.x' }} + type=raw,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }} + # Supported release branches - use the fetched branch name for comments + type=raw,value=5.x,enable=${{ github.ref_name == '5.x' || github.event.pull_request.base.ref == '5.x' || steps.pr-branch.outputs.base_ref == '5.x' }} + type=raw,value=6.x,enable=${{ github.ref_name == '6.x' || github.event.pull_request.base.ref == '6.x' || steps.pr-branch.outputs.base_ref == '6.x' }} + type=raw,value=7.x,enable=${{ github.ref_name == '7.x' || github.event.pull_request.base.ref == '7.x' || steps.pr-branch.outputs.base_ref == '7.x' }} # Always add an immutable sha tag - type=raw,value=sha-${{ github.event.issue.pull_request && 'manual' || github.sha }},enable=false - type=raw,value=sha-${{ github.event.pull_request.head.sha || github.sha }},enable=${{ github.event_name == 'pull_request' || github.event.issue.pull_request != null }} + type=raw,value=sha-${{ github.event.pull_request.head.sha || steps.pr-branch.outputs.head_sha || github.sha }} labels: | maintainer=Victorian Department of Government Services repository=${{ github.repositoryUrl }} From 489640f395d2301f8ef53c671c3470dd5a4d1779 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 13:24:42 +1100 Subject: [PATCH 6/9] Use output from xt0rted/pull-request-comment-branch --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index c92b636b..58d1f792 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/checkout@v4 if: ( github.event.issue.pull_request && contains(github.event.comment.body, '/build') ) with: - ref: refs/pull/${{ github.event.issue.number }}/head + ref: ${{ steps.pr-branch.outputs.head_ref }} - name: Login to registry ${{ env.REGISTRY }} uses: docker/login-action@v3 From a0b7d591cd50bc5ce0dc61ced17288d726a86485 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 13:33:09 +1100 Subject: [PATCH 7/9] Adjust condition for stable branch tagging --- .github/workflows/build-deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 58d1f792..832c1b93 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -73,9 +73,9 @@ jobs: # Comment-triggered builds: pr- type=raw,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }} # Supported release branches - use the fetched branch name for comments - type=raw,value=5.x,enable=${{ github.ref_name == '5.x' || github.event.pull_request.base.ref == '5.x' || steps.pr-branch.outputs.base_ref == '5.x' }} - type=raw,value=6.x,enable=${{ github.ref_name == '6.x' || github.event.pull_request.base.ref == '6.x' || steps.pr-branch.outputs.base_ref == '6.x' }} - type=raw,value=7.x,enable=${{ github.ref_name == '7.x' || github.event.pull_request.base.ref == '7.x' || steps.pr-branch.outputs.base_ref == '7.x' }} + type=raw,value=5.x,enable=${{ github.ref_name == '5.x' || github.event.pull_request.base.ref == '5.x' || ! steps.pr-branch.outputs.head_ref }} + type=raw,value=6.x,enable=${{ github.ref_name == '6.x' || github.event.pull_request.base.ref == '6.x' || ! steps.pr-branch.outputs.head_ref }} + type=raw,value=7.x,enable=${{ github.ref_name == '7.x' || github.event.pull_request.base.ref == '7.x' || ! steps.pr-branch.outputs.head_ref }} # Always add an immutable sha tag type=raw,value=sha-${{ github.event.pull_request.head.sha || steps.pr-branch.outputs.head_sha || github.sha }} labels: | From df955753fcb6d58426584671f741c85dbdf27a23 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 13:41:23 +1100 Subject: [PATCH 8/9] Remove debug comment --- images/php/settings.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/images/php/settings.php b/images/php/settings.php index cdd0b677..36897eb4 100755 --- a/images/php/settings.php +++ b/images/php/settings.php @@ -436,5 +436,3 @@ $config['environment_indicator.indicator']['name'] = "Deployed: $label"; } } - -// Test comment SDPPE-91 \ No newline at end of file From d966b8460d99de970bb76d65685422735630bf1c Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Wed, 31 Dec 2025 13:42:06 +1100 Subject: [PATCH 9/9] Removed debug workflow --- .github/workflows/build-deploy.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 8774d2af..832c1b93 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -16,15 +16,6 @@ on: env: REGISTRY: ghcr.io jobs: - debug: - if: (github.event.issue.pull_request && contains(github.event.comment.body, '/debug')) - runs-on: ubuntu-latest - steps: - - name: Get PR branch - id: pr-branch - uses: xt0rted/pull-request-comment-branch@v3 - - name: Echo PR Base Branch - run: echo "The base branch for this PR is ${{ toJson(steps.pr-branch.outputs) }}" buildx: if: | github.event.pull_request.merged == true ||