CRON Delete Composer Weeknightly #76
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: CRON Delete Composer Weeknightly | |
on: | |
schedule: | |
- cron: '0 1 * * *' # At 01:00 UTC, which is every night 6PM MST | |
workflow_dispatch: | |
jobs: | |
delete-composer: | |
if: github.repository == 'SatcherInstitute/health-equity-tracker' | |
runs-on: ubuntu-latest | |
env: | |
ENV_NAME: "data-ingestion-environment" | |
LOCATION: "us-central1" | |
steps: | |
- name: Check Out Code | |
uses: actions/checkout@v4 | |
- id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.TEST_DEPLOYER_SA_KEY }} | |
- name: Set Up gcloud | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ secrets.TEST_PROJECT_ID }} | |
- name: Ensure Composer Environment Is Deleted | |
id: ensure-composer-deleted | |
run: | | |
if gcloud composer environments describe "$ENV_NAME" --location="$LOCATION" &>/dev/null; then | |
echo "Composer environment exists. Deleting..." | |
gcloud composer environments delete "$ENV_NAME" --quiet --location="$LOCATION" | |
else | |
echo "DEV Composer environment doesn't exist." | |
fi | |
- name: Run Disk Cleanup Script | |
working-directory: ./scripts | |
run: | | |
./cleanup_cloud_disks.sh -D ${{ secrets.TEST_PROJECT_ID }} |