Skip to content

🧹 Clean stale build artifacts #98

🧹 Clean stale build artifacts

🧹 Clean stale build artifacts #98

Workflow file for this run

name: 🧹 Clean stale build artifacts
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * SUN"
jobs:
clean:
name: Clean
runs-on: ubuntu-22.04
container:
image: nycplanning/dev:latest
defaults:
run:
shell: bash
env:
GHP_TOKEN: ${{ github.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Load Secrets
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
BUILD_ENGINE_SERVER: "op://Data Engineering/EDM_DATA/server_url"
DOCKER_USERNAME: "op://Data Engineering/Dockerhub/username"
DOCKER_PASSWORD: "op://Data Engineering/Dockerhub/password"
AWS_S3_ENDPOINT: "op://Data Engineering/DO_keys/AWS_S3_ENDPOINT"
AWS_SECRET_ACCESS_KEY: "op://Data Engineering/DO_keys/AWS_SECRET_ACCESS_KEY"
AWS_ACCESS_KEY_ID: "op://Data Engineering/DO_keys/AWS_ACCESS_KEY_ID"
- name: Run Container Setup
working-directory: ./
run: ./bash/docker_container_setup.sh
- name: Delete build artifacts
run: python3 admin/ops/clean_build_artifacts.py schemas
- name: Delete docker images
run: python3 admin/ops/clean_build_artifacts.py dockerhub_tags
create_issue_on_failure:
needs: clean
runs-on: ubuntu-22.04
if: ${{ failure() && (github.event_name == 'schedule') }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: Create issue on failure
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTION: ${{ github.workflow }}
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
filename: .github/ISSUE_TEMPLATE/scheduled_action_failure.md