From cb58f41ef375381842ade9f26c2f64cedf37c218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:48:41 +0100 Subject: [PATCH 1/6] format --- .github/workflows/cleanup-old-results.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index 1241138..ca86b76 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -19,17 +19,17 @@ jobs: - 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 + 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 From 8e14a120752c6a677420f31a321a8671af86592a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:48:54 +0100 Subject: [PATCH 2/6] debug --- .github/workflows/cleanup-old-results.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index ca86b76..8eba260 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -19,11 +19,13 @@ jobs: - name: Delete old results run: | date=`date -d "3 months ago"` + echo $date git ls-files | while read file do if [ "$(git log --since \"$date\" -- $file)" == "" ]; then rm "$file" fi + break done - name: Store results in git From 66ed91ee81ff0f13e9a858d65d84426c1e76bbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:52:26 +0100 Subject: [PATCH 3/6] try specific format --- .github/workflows/cleanup-old-results.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index 8eba260..d71f030 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -18,7 +18,7 @@ jobs: - name: Delete old results run: | - date=`date -d "3 months ago"` + date=`date "+%Y-%m-%d" -d "3 months ago"` echo $date git ls-files | while read file do From ebbb9c8d8e33fbd51d7fe35c1d032baf13559ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:53:29 +0100 Subject: [PATCH 4/6] run on all files --- .github/workflows/cleanup-old-results.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index d71f030..fc641ac 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -25,7 +25,6 @@ jobs: if [ "$(git log --since \"$date\" -- $file)" == "" ]; then rm "$file" fi - break done - name: Store results in git From e0f69cfc3683fe0a191f047d37c4f9d7cee653ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:56:03 +0100 Subject: [PATCH 5/6] get commits --- .github/workflows/cleanup-old-results.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index fc641ac..17eead6 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "results" + fetch-depth: 0 - name: Delete old results run: | From c5b156cac32de3d278eeae4c845b5997b28b81f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Mar 2024 11:58:42 +0100 Subject: [PATCH 6/6] add permissions --- .github/workflows/cleanup-old-results.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cleanup-old-results.yml b/.github/workflows/cleanup-old-results.yml index 17eead6..074f102 100644 --- a/.github/workflows/cleanup-old-results.yml +++ b/.github/workflows/cleanup-old-results.yml @@ -9,6 +9,8 @@ jobs: cleanup-results: name: Cleanup Results runs-on: ubuntu-latest + permissions: + contents: write steps: