Skip to content

Clean Validation Environments #18913

Clean Validation Environments

Clean Validation Environments #18913

---
name: Clean Validation Environments
on: # yamllint disable-line rule:truthy
schedule:
# Every 2 hours
- cron: "0 */1 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
clean:
name: Clean
runs-on: ubuntu-latest
environment: CICD
timeout-minutes: 30
permissions:
id-token: write
contents: read
pull-requests: read # For checking PRs
actions: read # For checking workflow runs
steps:
- uses: actions/checkout@v6
with:
# This is CRITICAL since we're making decisions based on branch existence
fetch-depth: 0
persist-credentials: false
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
environment: ${{ (secrets.AZURE_ENVIRONMENT != '' && secrets.AZURE_ENVIRONMENT) || 'AzureCloud' }}
- name: Run clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAIN_TRE_ID: ${{ secrets.TRE_ID }}
GITHUB_REPOSITORY: ${{ github.repository}}
BRANCH_LAST_ACTIVITY_IN_HOURS_FOR_STOP: 4
BRANCH_LAST_ACTIVITY_IN_HOURS_FOR_DESTROY: 48
run: devops/scripts/clean_ci_validation_envs.sh