mirror of
https://github.com/itm4n/PrivescCheck
synced 2026-06-08 14:54:28 +00:00
Add a job to delete old releases and tags
This commit is contained in:
@@ -193,3 +193,20 @@ jobs:
|
||||
else
|
||||
echo "[*] No release to create"
|
||||
fi
|
||||
|
||||
clean-up-release-history:
|
||||
name: Clean up release history
|
||||
needs: [create-release]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out master branch
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: master
|
||||
- name: Clean up release and tag history (keep last 10 entries)
|
||||
id: clean-up-release-history
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
shell: bash
|
||||
run: |
|
||||
bash ./.github/workflows/clean_up_release_and_tag_history.sh
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# 1. List all releases and tags
|
||||
# 2. Select the ones older than the last 10 entries
|
||||
# 3. Iterate the list to delete them sequentially
|
||||
#
|
||||
|
||||
last_error_code=0
|
||||
|
||||
for t in $(gh release list --json tagName --jq .[].tagName | tail -n+11); do
|
||||
echo "[*] Delete release and tag: ${t}";
|
||||
if ! gh release delete "${t}" --cleanup-tag --yes; then
|
||||
last_error_code=$?
|
||||
fi
|
||||
done
|
||||
|
||||
exit $last_error_code
|
||||
Reference in New Issue
Block a user