Skip to content

Commit

Permalink
workflow test [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Aug 7, 2023
1 parent 6988fc2 commit dd8363c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/delete-old-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
with:
github-token: ${{ secrets.DELETE_PACKAGES_TOKEN }}
script: |
const now = new Date();
const epoch_minutes = Math.round(now.getTime() / 1000 / 60);
const response = await github.request("GET /${{ env.OWNER }}/packages/container/${{ github.event.repository.name }}/versions",
{ per_page: ${{ env.PER_PAGE }}
});
Expand All @@ -42,7 +45,9 @@ jobs:
});
for (version of response.data) {
console.log(version)
let updated_at = new Date(version.updated_at)
let minutes_old = epoch_minutes - Math.round(updated_at.getTime() / 1000 / 60);
console.log("Package is " + minutes_old + " minutes old")
if (version.metadata.container.tags.length == 0) {
console.log("delete " + version.id)
const deleteResponse = await github.request("DELETE /${{ env.OWNER }}/packages/container/${{ github.event.repository.name }}/versions/" + version.id, { });
Expand Down

0 comments on commit dd8363c

Please sign in to comment.