Skip to content

Delete unused packages #2

Delete unused packages

Delete unused packages #2

Workflow file for this run

name: Delete unused packages
on:
workflow_dispatch:
schedule:
- cron: '0 */8 * * *'
jobs:
run:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete untagged images of shopware-demo-environment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.request("GET /${{ env.OWNER }}/packages/container/shopware-demo-environment/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/shopware-demo-environment/versions/" + version.id, { });
console.log("status " + deleteResponse.status)
}
}
env:
OWNER: orgs/FriendsOfShopware
PACKAGE_NAME: ${{ matrix.package-name }}
PER_PAGE: 100