name: 'Periodic job: Cleanup GH repos, Quay repos, and bots' # Can be triggered manually with a specific branch. # # Konflux staging Application cleanup was moved out of this workflow into an # in-cluster CronJob in infra-deployments (application-cleaner): # https://github.com/redhat-appstudio/infra-deployments/tree/main/components/application-cleaner # Migration PR: https://github.com/redhat-appstudio/infra-deployments/pull/13246 # # For ad-hoc/manual cleanup from a local environment, scripts/ci_cleanup.sh # still supports a `konflux` target (requires oc + a personal token with # delete access to Applications in the target namespace). on: workflow_dispatch: inputs: ref: description: Git ref required: true default: main # Every Sunday at 1:00 AM UTC schedule: - cron: '0 1 * * 0' jobs: periodic-cleanup: runs-on: ubuntu-latest env: JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} PERIODIC_JOBS_SLACK_WEBHOOK_URL: ${{ secrets.PERIODIC_JOBS_SLACK_WEBHOOK_URL }} # secrets GH_TOKEN: ${{ secrets.HAC_TEST_GH_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_CLEANUP_TOKEN }} QUAY_TEST_ORG: ${{ secrets.QUAY_TEST_ORG }} JOB_TYPE: 'periodic-cleanup' steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Checkout specific branch with: ref: ${{ github.event.inputs.ref }} - name: Cleanup GitHub repos id: github if: ${{ always() }} run: | chmod +x ./scripts/ci_cleanup.sh ./scripts/ci_cleanup.sh github - name: Cleanup Quay repos and bots id: quay if: ${{ always() }} run: | ./scripts/ci_cleanup.sh quay - name: Report job result to Slack if: ${{ always() }} run: | if [[ "${{ steps.github.outcome }}" == 'success' && "${{ steps.quay.outcome }}" == 'success' ]]; then ./pr_check.sh send-report success else ./pr_check.sh send-report failure fi