Skip to content

Commit

Permalink
Fix Snowflake cleanup (#130)
Browse files Browse the repository at this point in the history
* Fix Snowflake cleanup

* Add safeguard in cleanup action in case 'main' branch deleted
  • Loading branch information
philerooski authored Jul 17, 2024
1 parent aa8fc1c commit 22803f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

snowflake-delete:
name: Delete Snowflake development environment
if: ${{ github.ref_name != 'main' && github.ref_name != 'staging' }}
if: ${{ github.event.ref != 'main' && github.event.ref != 'staging' }}
runs-on: ubuntu-latest
env:
PRIVATE_KEY_PASSPHRASE: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_PASSPHRASE }}
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
snow sql \
-q "
SET safe_environment_identifier = (SELECT REPLACE('$GITHUB_REF_NAME', '-', '_'));
SET safe_environment_identifier = (SELECT REPLACE('${{ github.event.ref }}', '-', '_'));
SET database_identifier = CONCAT('recover_', \$safe_environment_identifier);
DROP DATABASE IDENTIFIER(\$database_identifier);
"
Expand Down

0 comments on commit 22803f2

Please sign in to comment.