From c4d6398a1b9e2e6e3c48d6496220b6843951de8d Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" Date: Sat, 16 Nov 2024 15:26:29 -0800 Subject: [PATCH 1/2] Update action to v4 --- .github/workflows/keep_latest60_results.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/keep_latest60_results.yml b/.github/workflows/keep_latest60_results.yml index 2ac7d31ab..0423eef48 100644 --- a/.github/workflows/keep_latest60_results.yml +++ b/.github/workflows/keep_latest60_results.yml @@ -4,14 +4,15 @@ on: schedule: # Runs at 5 AM UTC (10 PM PDT / 9 PM PST) - cron: '0 5 * * *' - workflow_dispatch: # Allows manual trigger from the GitHub UI + # Allows manual trigger from the GitHub UI + workflow_dispatch: jobs: cleanup: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cleanup old test results run: | From 7649cf81a44b06add1e8b525e7615bdd0474944a Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" Date: Sat, 16 Nov 2024 17:44:46 -0800 Subject: [PATCH 2/2] Ensure we look only for results dirs --- .github/workflows/keep_latest60_results.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/keep_latest60_results.yml b/.github/workflows/keep_latest60_results.yml index 0423eef48..9d6ab9aa0 100644 --- a/.github/workflows/keep_latest60_results.yml +++ b/.github/workflows/keep_latest60_results.yml @@ -17,13 +17,13 @@ jobs: - name: Cleanup old test results run: | # Count the number of top-level directories (assuming they are dated test results) - total_dirs=$(ls -d */ | wc -l) + total_dirs=$(ls -d 20*/ | wc -l) echo "Total directories: $total_dirs" # If there are more than 60 directories, delete the oldest if [ $total_dirs -gt 60 ]; then # List directories sorted by date and delete the oldest - ls -dt */ | tail -n +61 | xargs rm -rf + ls -dt 20*/ | tail -n +61 | xargs rm -rf fi - name: Commit and push changes