Skip to content

Commit f428c4a

Browse files
committed
chore: add browse previous days fork list links
1 parent 47d1029 commit f428c4a

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/refresh-forks-list.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,34 @@ jobs:
139139
140140
---
141141
142-
* **Last updated:** ${CURRENT_TIME}
143-
144-
* **Auto-updates:** This list refreshes every 6 hours
145-
146-
---
147-
148-
### Can't Find What You Need?
149-
150-
If none of the recent forks have the macOS version you need:
151-
1. [Fork this repository](../../fork)
152-
2. Follow the [Usage guide](../../#how-to-use) to build your own image
153-
3. Your fork will appear here for others to benefit from!
154142
EOF
155143
156-
- name: Update release notes
144+
for i in $(seq 1 12); do
145+
PAST_DATE=$(date -u -d "${i} days ago" +"%Y%m%d")
146+
DISPLAY_DATE=$(date -u -d "${i} days ago" +"%Y-%m-%d")
147+
echo "- [Fork list ${DISPLAY_DATE}](https://github.com/${{ github.repository }}/releases/tag/forks-list-${PAST_DATE})" >> release_notes.md
148+
done
149+
150+
- name: Create forks list
157151
env:
158152
GH_TOKEN: ${{ github.token }}
159153
run: |
160154
DATE_TAG=$(date -u +"%Y%m%d")
161155
RELEASE_NAME="forks-list-${DATE_TAG}"
162156
157+
# Delete releases + tags older than 12 days
158+
CUTOFF_DATE=$(date -u -d '12 days ago' +"%Y%m%d")
159+
gh release list --limit 13 --json tagName \
160+
| jq -r '.[].tagName' \
161+
| grep '^forks-list-' \
162+
| while read -r tag; do
163+
TAG_DATE="${tag#forks-list-}"
164+
if [ "$TAG_DATE" -le "$CUTOFF_DATE" ] 2>/dev/null; then
165+
echo "Deleting old release: $tag"
166+
gh release delete "$tag" -y --cleanup-tag || true
167+
fi
168+
done
169+
163170
if gh release view "$RELEASE_NAME"; then
164171
gh release delete "$RELEASE_NAME" -y --cleanup-tag
165172
sleep 5

0 commit comments

Comments
 (0)