Delete unused packages #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |