From fe2acfc4b2b170fc79c1b928e70d67f6c893be1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sun, 17 Mar 2024 12:02:43 +0100 Subject: [PATCH] Iterate on delete (#33) * format * debug * try specific format * run on all files * get commits * add permissions --- .github/workflows/cleanup-old-results.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index 1241138..074f102 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -9,27 +9,31 @@ jobs: cleanup-results: name: Cleanup Results runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 with: ref: "results" + fetch-depth: 0 - 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 + date=`date "+%Y-%m-%d" -d "3 months ago"` + echo $date + 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 config user.email '<>' git add . git commit -m "Results Cleanup" git push