Skip to content

Commit a288b4e

Browse files
Update tag logic to use xt0rted/pull-request-comment-branch action
1 parent a1f3f88 commit a288b4e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/build-deploy.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ jobs:
2727
matrix:
2828
images: ${{ fromJson(vars.IMAGES) }}
2929
steps:
30+
- name: Get PR branch
31+
if: github.event.issue.pull_request
32+
id: pr-branch
33+
uses: xt0rted/pull-request-comment-branch@v3
34+
3035
- name: Set up QEMU
3136
uses: docker/setup-qemu-action@v3
3237

@@ -63,17 +68,16 @@ jobs:
6368
type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }}
6469
# Tag with the PR base branch name on merge
6570
type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }}
66-
# Manual/scheduled runs tag by branch ref (for whichever release branch the run targets)
71+
# Manual/scheduled runs tag by branch ref
6772
type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }}
6873
# Comment-triggered builds: pr-<num>
69-
type=raw,event=default,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }}
70-
# Supported release branches
71-
type=raw,value=5.x,enable=${{ github.ref == 'refs/heads/5.x' || github.event.pull_request.base.ref == '5.x' }}
72-
type=raw,value=6.x,enable=${{ github.ref == 'refs/heads/6.x' || github.event.pull_request.base.ref == '6.x' }}
73-
type=raw,value=7.x,enable=${{ github.ref == 'refs/heads/7.x' || github.event.pull_request.base.ref == '7.x' }}
74+
type=raw,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }}
75+
# Supported release branches - use the fetched branch name for comments
76+
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' }}
77+
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' }}
78+
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' }}
7479
# Always add an immutable sha tag
75-
type=raw,value=sha-${{ github.event.issue.pull_request && 'manual' || github.sha }},enable=false
76-
type=raw,value=sha-${{ github.event.pull_request.head.sha || github.sha }},enable=${{ github.event_name == 'pull_request' || github.event.issue.pull_request != null }}
80+
type=raw,value=sha-${{ github.event.pull_request.head.sha || steps.pr-branch.outputs.head_sha || github.sha }}
7781
labels: |
7882
maintainer=Victorian Department of Government Services
7983
repository=${{ github.repositoryUrl }}

0 commit comments

Comments
 (0)