Skip to content

Commit d7a89c2

Browse files
committed
fix: PR base branch condition
1 parent fe9f74a commit d7a89c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

template/.github/workflows/build.yml.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,11 @@ jobs:
346346
crate: cargo-edit
347347
bin: cargo-set-version
348348
- name: Update version if PR against main branch
349-
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
349+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' }}
350350
run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }}
351351
- name: Update version if PR against non-main branch
352352
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
353-
if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
353+
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }}
354354
env:
355355
PR_NUMBER: ${{ github.event.pull_request.number }}
356356
run: |
@@ -421,11 +421,11 @@ jobs:
421421
crate: cargo-edit
422422
bin: cargo-set-version
423423
- name: Update version if PR against main branch
424-
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
424+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' }}
425425
run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }}
426426
- name: Update version if PR against non-main branch
427427
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
428-
if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
428+
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }}
429429
env:
430430
PR_NUMBER: ${{ github.event.pull_request.number }}
431431
run: |

0 commit comments

Comments
 (0)