fix: get PR only when the tag is not provided. #276
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
concurrency: | |
# Cancel in progress for PR open and close | |
group: ${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
testing: | |
name: Testing | |
uses: ./.github/workflows/.pr-close.yml | |
with: | |
remove_pvc: | | |
frontend, | |
backend | |
validate: | |
name: Validate | |
uses: ./.github/workflows/.pr-validate.yml | |
with: | |
markdown_links: | | |
- [Frontend](https://${{ github.event.repository.name }}-${{ github.event.number }}-frontend.apps.silver.devops.gov.bc.ca) | |
- [Backend](https://${{ github.event.repository.name }}-${{ github.event.number }}-frontend.apps.silver.devops.gov.bc.ca/api) | |
builds: | |
name: Fake Builds (retags) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
package: [backend, frontend, migrations] | |
timeout-minutes: 1 | |
steps: | |
- uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: latest | |
tags: ${{ github.event.number }} | |
- run: | | |
# Verify tagging | |
INSPECT="docker manifest inspect ghcr.io/${{ github.repository }}/${{ matrix.package }}" | |
SOURCE=$(${INSPECT}:latest | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest') | |
TARGET=$(${INSPECT}:${{ github.event.number }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest') | |
if [ "${SOURCE}" != "${TARGET}" ]; then | |
echo "ERROR: Tagging failed!" | |
exit 1 | |
fi | |
deploys: | |
name: Deploys | |
needs: [builds, validate] | |
uses: ./.github/workflows/.deployer.yml | |
secrets: | |
oc_namespace: ${{ secrets.oc_namespace }} | |
oc_token: ${{ secrets.oc_token }} | |
with: | |
tag: ${{ github.event.number }} | |
results: | |
name: Results | |
needs: [deploys] | |
runs-on: ubuntu-24.04 | |
steps: | |
- if: needs.deploys.outputs.triggered == 'true' | |
run: echo "Success!" | |
- if: needs.deploys.outputs.triggered != 'true' | |
run: | | |
# Handle fail | |
echo "needs.deploys == ${{ toJson(needs.deploys) }}" | |
exit 1 |