{"id":13828835,"url":"https://github.com/WyriHaximus/github-action-delete-package","last_synced_at":"2025-07-09T06:33:11.449Z","repository":{"id":65158626,"uuid":"220855693","full_name":"WyriHaximus/github-action-delete-package","owner":"WyriHaximus","description":"Delete a Docker image from the Github Docker Registry","archived":false,"fork":false,"pushed_at":"2023-12-04T20:43:53.000Z","size":13,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-17T17:42:32.277Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-11-10T21:47:02.000Z","updated_at":"2023-02-21T18:45:11.000Z","dependencies_parsed_at":"2024-01-30T23:58:50.535Z","dependency_job_id":"9711abf5-790a-4132-99b6-036e6b9df10b","html_url":"https://github.com/WyriHaximus/github-action-delete-package","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"2e8d22ab7b2412426302d8b4bf56f761ec60e8e3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-delete-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-delete-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-delete-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fgithub-action-delete-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/github-action-delete-package/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492420,"owners_count":17482869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-04T09:03:13.169Z","updated_at":"2024-11-20T08:31:14.067Z","avatar_url":"https://github.com/WyriHaximus.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Delete package from the Github Package Registry\n\nGithub Action that deletes the given package from the Github Package Registry.\n\n## Options\n\nThis action supports the following options.\n\n### packageVersionId\n\nThe version id of the package to be deleted, when null this action exits with a failure.\n\n* *Required*: `Yes`\n* *Type*: `string`\n\n## Output\n\nThis action has only one output and that's the `success` output. This is the value we get back from the GraphQL API \nindicating whether the operation has been a success or failure. We'll leave it up to you to consider what that means \nfor your workflow. \n\n## Example\n\nThe following example is a slimmed down version of my Docker Image clean up workflow. It runs hourly and takes at most \n10 seconds, including the building of this action. The workflow picks up one Docker Image and deletes that one, the next \nhour it will try to get another package id and delete it. When there isn't a Docker Image to delete it will silently \nskip the deletion and try again in an hour.\n\n```yaml\nname: Docker Image Cleanup\non:\n  schedule:\n    - cron:  '33 * * * *'\njobs:\n  cleanup-one-old-or-with-the-wrong-name-tag:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Fetch releases\n        run: |\n          curl -X POST \\\n            -s \\\n            -H \"Accept: application/vnd.github.package-deletes-preview+json\" \\\n            -H \"Authorization: bearer ${{ secrets.GITHUB_TOKEN }}\" \\\n            -d '{\"query\":\"query {repository(owner:\\\"${{ OWNER }}\\\", name:\\\"${{ REPOSITORY }}\\\") {registryPackages(last:1) {edges{node{id, name, versions(last:100){edges {node {id, updatedAt, version}}}}}}}}\"}' \\\n            -o /tmp/response.json \\\n            --url https://api.github.com/graphql\n      - name: Filter Releases\n        run: \"cat /tmp/response.json | jq -r 'def daysAgo(days): (now | floor) - (days * 86400); [.data.repository.registryPackages.edges[0].node.versions.edges | sort_by(.node.updatedAt|fromdate) | reverse | .[] | select( .node.version != \\\"docker-base-layer\\\" ) | .value[].node.id] | unique_by(.) | @csv'  | cut -d, -f1  | sed -e 's/^\\\"//' -e 's/\\\"$//' \u003e /tmp/release.json\"\n      - name: Show Release\n        id: release\n        run: printf \"::set-output name=id::%s\" $(cat /tmp/release.json)\n      - name: Delete Release\n        uses: WyriHaximus/github-action-delete-package@master\n        if: steps.release.outputs.id != ''\n        with:\n          packageVersionId: ${{ steps.release.outputs.id }}\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n## License ##\n\nCopyright 2019 [Cees-Jan Kiewiet](http://wyrihaximus.net/)\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWyriHaximus%2Fgithub-action-delete-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWyriHaximus%2Fgithub-action-delete-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWyriHaximus%2Fgithub-action-delete-package/lists"}