Only use default tag when in pull request
All checks were successful
Build container image / Build and push image (pull_request) Successful in 19m47s

This commit is contained in:
2025-11-11 15:52:58 -05:00
parent d8bfa2f51b
commit 5d4f3b9c2f

View File

@@ -52,7 +52,7 @@ jobs:
run: | run: |
echo "DEFAULT_TAG=pr-${PULL_REQUEST_NUMBER}" >> ${GITHUB_ENV} echo "DEFAULT_TAG=pr-${PULL_REQUEST_NUMBER}" >> ${GITHUB_ENV}
- name: Setup other dependencies - name: Setup Podman and other dependencies
shell: bash shell: bash
run: | run: |
sudo apt-get update sudo apt-get update
@@ -133,16 +133,14 @@ jobs:
- name: Build Image - name: Build Image
id: build_image id: build_image
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 shell: bash
with: run: |
containerfiles: | buildah bud \
./Containerfile --format docker \
image: ${{ env.IMAGE_NAME }} --tag "localhost/${IMAGE_NAME}:${DEFAULT_TAG}" \
tags: ${{ steps.metadata.outputs.tags }} --build-arg BASE_IMAGE=${BASE_IMAGE} \
oci: false --build-arg FEDORA_VERSION=${FEDORA_VERSION} \
build-args: | -f ./Containerfile
BASE_IMAGE=${BASE_IMAGE}
FEDORA_VERSION=${FEDORA_VERSION}
# These `if` statements are so that pull requests for your custom images do not make it publish any packages under your name without you knowing # These `if` statements are so that pull requests for your custom images do not make it publish any packages under your name without you knowing
# They also check if the runner is on the default branch so that things like the merge queue (if you enable it), are going to work # They also check if the runner is on the default branch so that things like the merge queue (if you enable it), are going to work
@@ -184,7 +182,7 @@ jobs:
with: with:
registry: ${{ env.IMAGE_REGISTRY }} registry: ${{ env.IMAGE_REGISTRY }}
image: ${{ env.IMAGE_NAME }} image: ${{ env.IMAGE_NAME }}
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ github.event_name != 'pull_request' && steps.metadata.outputs.tags || env.DEFAULT_TAG }}
username: ${{ env.REGISTRY_USER }} username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }} password: ${{ env.REGISTRY_PASSWORD }}