ci: fix endpoint
This commit is contained in:
4
.github/workflows/maintenance.yml
vendored
4
.github/workflows/maintenance.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
|||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
- name: Run deletion script 🗑
|
- name: Run deletion script 🗑
|
||||||
run: ./delete_ghcr_dangling_images.sh ${{ matrix.container }}
|
run: ./delete_ghcr_dangling_images.sh lowlighter ${{ matrix.container }}
|
||||||
working-directory: ./.github/workflows/maintenance
|
working-directory: ./.github/workflows/maintenance
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GHCR_BOT_TOKEN }}
|
GITHUB_TOKEN: ${{ github.token }} #${{ secrets.GHCR_BOT_TOKEN }}
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ set -e
|
|||||||
# You need to be logged to 'gh' first.
|
# You need to be logged to 'gh' first.
|
||||||
|
|
||||||
# package_name syntax. i.e: jellyfin-vue
|
# package_name syntax. i.e: jellyfin-vue
|
||||||
container="$1"
|
owner="$1"
|
||||||
|
container="$2"
|
||||||
temp_file="ghcr_prune.ids"
|
temp_file="ghcr_prune.ids"
|
||||||
rm -rf $temp_file
|
rm -rf $temp_file
|
||||||
|
|
||||||
echo "Fetching dangling images from GHCR..."
|
echo "Fetching dangling images from GHCR..."
|
||||||
gh api /user/packages/container/${container}/versions --paginate > $temp_file
|
gh api /users/${owner}/packages/container/${container}/versions --paginate > $temp_file
|
||||||
|
|
||||||
ids_to_delete=$(cat "$temp_file" | jq -r '.[] | select(.metadata.container.tags==[]) | .id')
|
ids_to_delete=$(cat "$temp_file" | jq -r '.[] | select(.metadata.container.tags==[]) | .id')
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ while read -r line; do
|
|||||||
id="$line"
|
id="$line"
|
||||||
echo "Processing image $id"
|
echo "Processing image $id"
|
||||||
## Workaround for https://github.com/cli/cli/issues/4286 and https://github.com/cli/cli/issues/3937
|
## Workaround for https://github.com/cli/cli/issues/4286 and https://github.com/cli/cli/issues/3937
|
||||||
echo -n | gh api --method DELETE /user/packages/container/${container}/versions/${id} --input -
|
echo -n | gh api --method DELETE /users/${owner}/packages/container/${container}/versions/${id} --input -
|
||||||
echo Dangling image with ID $id deleted successfully
|
echo Dangling image with ID $id deleted successfully
|
||||||
done <<< $ids_to_delete
|
done <<< $ids_to_delete
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user