File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,16 @@ name: Delete Old Releases
33on :
44 schedule :
55 - cron : ' 0 10 * * *' # Daily at 10:00 UTC which is 2:00 AM PST (UTC-8)
6- workflow_dispatch : # Manual trigger
7- push :
6+ workflow_dispatch :
7+ push :
8+ branches :
9+ - main
810
911jobs :
10- clean_releases :
12+ delete_release_assets :
1113 runs-on : ubuntu-latest
1214 steps :
13- - name : Delete old releases
15+ - name : Delete old release assets
1416 # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable
1517 env :
1618 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -19,12 +21,12 @@ jobs:
1921 run : |
2022
2123 # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000)
22- SECONDS_60_DAYS =5184000
24+ 60_DAYS_IN_SECONDS =5184000
2325
2426 # Store the list of asset ID and Name pairs in the variable
2527 # "ASSET_ID ASSET_NAME" on each line
2628 ASSETS_TO_DELETE=$(gh api --paginate repos/${{ github.repository }}/releases | \
27- jq -r --argjson cutoff_seconds "$SECONDS_60_DAYS " '
29+ jq -r --argjson cutoff_seconds "$60_DAYS_IN_SECONDS " '
2830 # Calculate the 60-day cutoff as now minus 60 days
2931 . as $releases | (now - $cutoff_seconds) as $cutoff |
3032
You can’t perform that action at this time.
0 commit comments