Skip to content

V27.1 Release Documentation (#708) #146

V27.1 Release Documentation (#708)

V27.1 Release Documentation (#708) #146

name: cleanup-docker-untagged
on:
push:
branches:
- main
env:
OWNER: orgs/nanocurrency
PACKAGE_NAME: nano-docs
PER_PAGE: 100
jobs:
container_cleanup:
runs-on: ubuntu-latest
steps:
- name: Clean up untagged containers
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 #v6.3.3
with:
github-token: ${{ secrets.GHCR_TOKEN }}
script: |
const response = await github.request("GET /${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/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 /${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { });
console.log("status " + deleteResponse.status)
}
}