Repository navigation
59 lines (55 loc) · 2.35 KB
/
Copy pathfreestyle-cleanup.yml
File metadata and controls
59 lines (55 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Evidence world cleanup
# Freestyle bills snapshot storage until deletion. This reclaims snapshots that
# OpenWork CI and the review app created and no longer need: old naming
# versions, previews nobody launched for a day, superseded cache layers and
# expired checkpoints. Snapshots with other names (personal worlds) are never
# touched. The job fails when too many remain, so a new leak is visible.
# Daytona evidence snapshots and sandboxes are reclaimed the same way, every 15
# minutes: CI fills the Daytona snapshot quota within hours otherwise.
on:
schedule:
- cron: "2,17,32,47 * * * *"
workflow_dispatch:
inputs:
dry_run:
description: "Only report what would be deleted."
type: boolean
default: false
permissions:
contents: read
concurrency:
group: freestyle-cleanup
cancel-in-progress: false
jobs:
cleanup:
# Only reviewed code on the default branch may run this job, including manual
# runs. The provider keys are repository secrets; this check does not limit
# which workflows can read them.
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Always the default branch: reviewed code only.
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 24.22.1
- uses: pnpm/action-setup@v4
with:
version: 11.4.0
- name: Install the evidence controllers only
run: pnpm --filter @openwork/world-freestyle... --filter @openwork/evidence-daytona... install --frozen-lockfile --ignore-scripts
- name: Delete snapshots OpenWork no longer needs
env:
FREESTYLE_API_KEY: ${{ secrets.FREESTYLE_API_KEY }}
DRY_RUN: ${{ inputs.dry_run && '--dry-run' || '' }}
run: node scripts/cleanup-freestyle.ts $DRY_RUN
- name: Delete Daytona evidence snapshots and sandboxes OpenWork no longer needs
if: always()
env:
DAYTONA_API_KEY: ${{ secrets.DAYTONA_API_KEY }}
DRY_RUN: ${{ inputs.dry_run && '--dry-run' || '' }}
run: node scripts/cleanup-daytona-evidence.ts $DRY_RUN