diff --git a/.github/workflows/cleanup-ephemeral-environment.yml b/.github/workflows/cleanup-ephemeral-environment.yml index f573d70560..d87b48ab0d 100644 --- a/.github/workflows/cleanup-ephemeral-environment.yml +++ b/.github/workflows/cleanup-ephemeral-environment.yml @@ -8,24 +8,27 @@ jobs: validate-pr: name: Validate PR runs-on: ubuntu-24.04 + outputs: + config-exists: ${{ steps.validate-config.outputs.config-exists }} steps: - name: Checkout PR uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Validate config existed on branch + id: validate-config run: | # Search the git history for config files, exit if not found. - if [[ -z $(git rev-list --all -- "ephemeral-environments/$GITHUB_HEAD_REF.yaml") ]]; then - echo "No ephemeral environment config found on branch, exiting." - exit 1 + if [[ -n $(git rev-list --all -- "ephemeral-environments/$GITHUB_HEAD_REF.yaml") ]]; then + echo "Ephemeral environment config found on branch, continuing." + echo "config-exists=true" >> $GITHUB_OUTPUT fi - echo "Ephemeral environment config found on branch, continuing." cleanup-config: name: Cleanup ephemeral environment runs-on: ubuntu-24.04 needs: validate-pr + if: ${{ needs.validate-pr.outputs.config-exists }} steps: - name: Log in to Azure - CI subscription uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0