Skip to content

[CI] Add a scheduled workflow to clean up old versions#4

Merged
giordano merged 6 commits intomasterfrom
mg/gha-old-versions
Dec 14, 2025
Merged

[CI] Add a scheduled workflow to clean up old versions#4
giordano merged 6 commits intomasterfrom
mg/gha-old-versions

Conversation

@giordano
Copy link
Collaborator

No description provided.

@giordano
Copy link
Collaborator Author

giordano commented Dec 13, 2025

Demo job (without actually pushing the changes), to show this worked as expected: https://github.com/CliMA/OceananigansDocumentation/actions/runs/20192351427/job/57971528829?pr=4

┌ Info: Old versions to be deleted
│   old_versions =
│    3-element Vector{String}:
│     "/home/runner/work/Oceananigan" ⋯ 21 bytes ⋯ "nigansDocumentation/v0.102.0"
│     "/home/runner/work/Oceananigan" ⋯ 21 bytes ⋯ "nigansDocumentation/v0.102.1"
└     "/home/runner/work/Oceananigan" ⋯ 21 bytes ⋯ "nigansDocumentation/v0.102.2"
[ Info: Deleting /home/runner/work/OceananigansDocumentation/OceananigansDocumentation/v0.102.0...
[ Info: Deleting /home/runner/work/OceananigansDocumentation/OceananigansDocumentation/v0.102.1...
[ Info: Deleting /home/runner/work/OceananigansDocumentation/OceananigansDocumentation/v0.102.2...

@giordano giordano marked this pull request as ready for review December 13, 2025 12:59
@giordano giordano requested a review from navidcy December 13, 2025 12:59
It's already available in most (but not all) GitHub Actions images, but better
to be safe.
@giordano giordano force-pushed the mg/gha-old-versions branch from c733ee6 to a6c3eaa Compare December 13, 2025 13:15

# Simple sanity check: make sure we didn't find too many versions to delete, that'd be
# suspicious, and a hint that something went wrong
old_versions_threshold = 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg, we can find multiple versions to clean up when there are a few bumps within the cron window?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which is once a week if I read that correctly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is a simple stupid check in case the script does something silly and unexpected and tries to delete too much stuff.

@glwagner
Copy link
Member

But we will still be able to find old versions ? Or is the idea that we will only host minor versions and not patches.

@giordano
Copy link
Collaborator Author

This script automates what @navidcy has been doing manually: remove all old patch versions, and keep only the latest one for each minor version.

@giordano giordano merged commit 9fb0e8b into master Dec 14, 2025
@giordano giordano deleted the mg/gha-old-versions branch December 15, 2025 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants