From a6ca138f93085fb699cf3e8a823e479563f4347e Mon Sep 17 00:00:00 2001 From: Alexandre Chatiron Date: Sun, 3 Mar 2024 14:48:21 +0100 Subject: [PATCH 1/3] feat(github-actions): move release-drafter in workflows --- .github/{release-drafts => workflows}/release-drafter.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{release-drafts => workflows}/release-drafter.yml (100%) diff --git a/.github/release-drafts/release-drafter.yml b/.github/workflows/release-drafter.yml similarity index 100% rename from .github/release-drafts/release-drafter.yml rename to .github/workflows/release-drafter.yml From 3a8e92ce78ceafe02684e00ddea12de3b7c58d52 Mon Sep 17 00:00:00 2001 From: Alexandre Chatiron Date: Sun, 3 Mar 2024 14:48:41 +0100 Subject: [PATCH 2/3] feat(github-actions): add delete-caches.yml --- .github/workflows/delete-caches.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/delete-caches.yml diff --git a/.github/workflows/delete-caches.yml b/.github/workflows/delete-caches.yml new file mode 100644 index 0000000000..3c6e1a09de --- /dev/null +++ b/.github/workflows/delete-caches.yml @@ -0,0 +1,42 @@ +name: Delete Caches +on: + schedule: + - cron: "0 */4 * * *" # Every 4th hour + +concurrency: + # Only run once and cancel other (previous) runs. + group: delete-caches + cancel-in-progress: true + +permissions: + actions: write # this permission is needed to delete cache + +jobs: + delete-public-local-caches: + name: Delete unneeded caches + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + gh cache list --limit 500 --order asc --sort last_accessed_at | grep 'play-published-local' > caches.txt || true + echo "Found $(wc -l < caches.txt | xargs) published local cache entries" + + current_time=$(date -u +%s) + expiration_time=$((current_time - 7200)) # 2 hour ago + + echo "Current time is $(date -d @$current_time)" + echo "All entries hadn't been use from $(date -d @$expiration_time) will be delete" + + while IFS=$'\t' read -r id name size created_at last_accessed_at; do + accessedTimestamp=$(date -u -d "$last_accessed_at" +%s) + # Uncomment to check on Mac OS + # accessedTimestamp=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$last_accessed_at" +%s) + if [ "$accessedTimestamp" -lt "$expiration_time" ]; then + echo "Delete $id $name ($last_accessed_at)" + gh cache delete $id + fi + done < caches.txt + rm -rf caches.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From b1fafd7250a349b75e4a1a07a32d18ff3c735e9e Mon Sep 17 00:00:00 2001 From: Alexandre Chatiron Date: Sun, 3 Mar 2024 14:49:06 +0100 Subject: [PATCH 3/3] feat(github-actions): change build-test condition --- .github/workflows/build-test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b42701ef75..b0ba6c35c5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -1,8 +1,11 @@ -name: Pull Requests +name: Check on: + pull_request: # Check Pull Requests + push: - pull_request: + branches: + - master # Check branch after merge concurrency: # Only run once for latest commit per ref and cancel other (previous) runs.