1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-03 14:03:33 +01:00

Move to more robust logic

This commit is contained in:
Micaiah Martin 2024-10-22 09:20:05 -06:00
parent f71f7458d3
commit 2678e26cd0

View File

@ -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