Skip to content

Commit

Permalink
Add cleaning action
Browse files Browse the repository at this point in the history
  • Loading branch information
Vatan Aksoy Tezer committed Aug 25, 2021
1 parent 75397fd commit b089978
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docker.yaml
Expand Up @@ -139,3 +139,29 @@ jobs:
cache-from: type=registry,ref=${{ env.IMAGE }}
cache-to: type=inline
tags: ${{ env.IMAGE }}

delete_untagged:
runs-on: ubuntu-latest
needs:
- release
- source
steps:
- name: Delete Untagged Images
uses: actions/github-script@v3
with:
github-token: ${{ secrets.DELETE_PACKAGES_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: ros-planning
PACKAGE_NAME: moveit2
PER_PAGE: 1000

0 comments on commit b089978

Please sign in to comment.