Schedule: Workspace Destroy #439
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: "Schedule: Workspace Destroy" | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs every day at midnight (UTC). | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
actions: write | |
env: | |
AWS_DEFAULT_REGION: eu-west-2 | |
TF_CLI_ARGS: -no-color | |
CI_ROLE_NAME: ${{ secrets.CI_ROLE_NAME }} | |
BRANCH_NAME: ${{ github.ref_name }} | |
jobs: | |
parse-secrets: | |
runs-on: [self-hosted, ci] | |
steps: | |
- id: parse-secrets | |
run: | | |
echo "::add-mask::${{ secrets.CI_ROLE_NAME }}" | |
build-base: | |
runs-on: [self-hosted, ci] | |
needs: [parse-secrets] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
- uses: ./.github/actions/make/ | |
with: | |
command: build | |
save-to-cache: "true" | |
restore-from-cache: "false" | |
destroy_expired_workspace: | |
runs-on: [self-hosted, ci] | |
needs: [build-base] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
- name: Destroy expired dev workspaces | |
uses: ./.github/actions/make/ | |
with: | |
command: destroy--expired ENVIRONMENT=dev TF_CLI_ARGS=${{ env.TF_CLI_ARGS }} | |
requires-aws: true | |
- name: Destroy expired ref workspaces | |
uses: ./.github/actions/make/ | |
with: | |
command: destroy--expired ENVIRONMENT=ref TF_CLI_ARGS=${{ env.TF_CLI_ARGS }} | |
requires-aws: true |