Skip to content

Delete unused packages #7066

Delete unused packages

Delete unused packages #7066

name: Delete unused packages
on:
workflow_dispatch:
schedule:
- cron: '0 */8 * * *'
jobs:
run:
strategy:
matrix:
package-name: [platform-plugin-dev, platform-plugin-dev-base]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete untagged images of ${{ matrix.package-name }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_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)
}
}
env:
OWNER: orgs/FriendsOfShopware # or orgs/<org name>
PACKAGE_NAME: ${{ matrix.package-name }}
PER_PAGE: 100