From c17d1fdc95bf029c908253cacee4e3908425ab98 Mon Sep 17 00:00:00 2001 From: encalada Date: Wed, 20 Sep 2023 16:13:05 +0200 Subject: [PATCH] Ensure assets deletion use a sleep time Recommended by github when hitting the secondary rate limits --- .github/workflows/cleanup-nightly-assets.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cleanup-nightly-assets.yaml b/.github/workflows/cleanup-nightly-assets.yaml index 29f5f678a3..c102f7d2c1 100644 --- a/.github/workflows/cleanup-nightly-assets.yaml +++ b/.github/workflows/cleanup-nightly-assets.yaml @@ -36,8 +36,13 @@ jobs: exit 0 fi + echo "[INFO] Going to delete ${ASSETS_TO_REMOVE} assets" + find $WORK_DIR -type f -iname "*.yaml" -printf "%f\n" | grep -v "${{ steps.currentmonth.outputs.date }}\|${{ steps.previousmonth.outputs.date }}" | while IFS= read FILE; do + # sleep 2 sec, as recommended by https://docs.github.com/en/rest/guides/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#dealing-with-secondary-rate-limits + sleep 2 + echo "[INFO] Going to delete ${FILE} asset" gh release delete-asset nightly $FILE -y done