From f428c4a170d0abd6e9ac8352eb3b8de0247fa31c Mon Sep 17 00:00:00 2001 From: Tieu Long Date: Mon, 30 Mar 2026 12:30:05 +0700 Subject: [PATCH] chore: add browse previous days fork list links --- .github/workflows/refresh-forks-list.yml | 33 ++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/refresh-forks-list.yml b/.github/workflows/refresh-forks-list.yml index 5219da0..ec77064 100644 --- a/.github/workflows/refresh-forks-list.yml +++ b/.github/workflows/refresh-forks-list.yml @@ -139,27 +139,34 @@ jobs: --- - * **Last updated:** ${CURRENT_TIME} - - * **Auto-updates:** This list refreshes every 6 hours - - --- - - ### Can't Find What You Need? - - If none of the recent forks have the macOS version you need: - 1. [Fork this repository](../../fork) - 2. Follow the [Usage guide](../../#how-to-use) to build your own image - 3. Your fork will appear here for others to benefit from! EOF - - name: Update release notes + for i in $(seq 1 12); do + PAST_DATE=$(date -u -d "${i} days ago" +"%Y%m%d") + DISPLAY_DATE=$(date -u -d "${i} days ago" +"%Y-%m-%d") + echo "- [Fork list ${DISPLAY_DATE}](https://github.com/${{ github.repository }}/releases/tag/forks-list-${PAST_DATE})" >> release_notes.md + done + + - name: Create forks list env: GH_TOKEN: ${{ github.token }} run: | DATE_TAG=$(date -u +"%Y%m%d") RELEASE_NAME="forks-list-${DATE_TAG}" + # Delete releases + tags older than 12 days + CUTOFF_DATE=$(date -u -d '12 days ago' +"%Y%m%d") + gh release list --limit 13 --json tagName \ + | jq -r '.[].tagName' \ + | grep '^forks-list-' \ + | while read -r tag; do + TAG_DATE="${tag#forks-list-}" + if [ "$TAG_DATE" -le "$CUTOFF_DATE" ] 2>/dev/null; then + echo "Deleting old release: $tag" + gh release delete "$tag" -y --cleanup-tag || true + fi + done + if gh release view "$RELEASE_NAME"; then gh release delete "$RELEASE_NAME" -y --cleanup-tag sleep 5