Skip to content

Commit

Permalink
Add script for weekly DockerHub cache cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Pechnikov committed Feb 8, 2025
1 parent 83004e7 commit da01ef1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/dockerhub-cache-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Cleanup Docker Hub Cache

on:
schedule:
- cron: '0 0 * * 0'

jobs:
delete-cache:
runs-on: ubuntu-latest
steps:
- name: Get Docker Hub JWT Token
run: |
TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \
-H "Content-Type: application/json" \
-d '{"username": "'"${{ secrets.DOCKER_USERNAME }}"'", "password": "'"${{ secrets.DOCKER_PASSWORD }}"'"}' | jq -r .token)
echo "TOKEN=$TOKEN" >> $GITHUB_ENV
- name: Delete cache tags from Docker Hub
run: |
curl -X DELETE -H "Authorization: JWT $TOKEN" \
"https://hub.docker.com/v2/repositories/pechnikov/pygmtsar/tags/cache-arm64/"
curl -X DELETE -H "Authorization: JWT $TOKEN" \
"https://hub.docker.com/v2/repositories/pechnikov/pygmtsar/tags/cache-amd64/"

0 comments on commit da01ef1

Please sign in to comment.