mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2025-01-08 16:19:34 +08:00
use custom action
This commit is contained in:
parent
0ddd7f8c0d
commit
b3a1b4ee83
1 changed files with 9 additions and 18 deletions
27
.github/workflows/purge-untagged-images.yml
vendored
27
.github/workflows/purge-untagged-images.yml
vendored
|
@ -9,22 +9,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Delete untagged images
|
||||
uses: actions/github-script@v3
|
||||
- name: Prune
|
||||
uses: bakito/action-ghcr-prune@main
|
||||
with:
|
||||
# token needs read:packages, delete:packages
|
||||
github-token: ${{ secrets.PRUNE_IMAGE_TOKEN }}
|
||||
script: |
|
||||
const response = await github.request("GET /users/bakito/packages/container/adguardhome-sync/versions",
|
||||
{ per_page: ${{ env.PER_PAGE }}
|
||||
});
|
||||
for(version of response.data) {
|
||||
if (version.metadata.container.tags.length == 0) {
|
||||
console.log("delete '" + version.id + "'")
|
||||
|
||||
const deleteResponse = await github.request("DELETE " + version.url, { });
|
||||
console.log("status " + deleteResponse.status)
|
||||
}
|
||||
}
|
||||
env:
|
||||
PER_PAGE: 50
|
||||
token: ${{ secrets.PRUNE_IMAGE_TOKEN }}
|
||||
user: bakito
|
||||
container: adguardhome-sync
|
||||
dry-run: true # Dry-run first, then change to `false`
|
||||
older-than: 7 # days
|
||||
keep-last: 2
|
||||
untagged: true
|
Loading…
Reference in a new issue