From e8e3ee1c754f1193f9edbcf26dabcffe7a253d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sun, 17 Mar 2024 11:42:40 +0100 Subject: [PATCH] cleanup job (#31) --- .github/workflows/cleanup-old-results.yml | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/cleanup-old-results.yml diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml new file mode 100644 index 0000000..1241138 --- /dev/null +++ b/.github/workflows/cleanup-old-results.yml @@ -0,0 +1,35 @@ +name: Cleanup old results + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' + +jobs: + cleanup-results: + name: Cleanup Results + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v4 + with: + ref: "results" + + - name: Delete old results + run: | + date=`date -d "3 months ago"` + git ls-files | while read file + do + if [ "$(git log --since \"$date\" -- $file)" == "" ]; then + rm "$file" + fi + done + + - name: Store results in git + run: | + git config user.name 'Workflow' + git config user.email '<>' + git add . + git commit -m "Results Cleanup" + git push