GitHub Action
DigitalOcean Registry Cleanup Action
This action deletes tags older than a specified number of days from a
DigitalOcean container registry, excluding the "latest" tag. Before using this
action, ensure you've set up doctl
and authenticated with DigitalOcean.
Name of the DigitalOcean container registry repository. Required.
If set to true, it will display tags to be deleted without actually deleting them. Default is "false".
Number of days. Tags older than these many days will be deleted. Default is "2".
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 1200
- uses: raisedadead/action-docr-cleanup@v1
with:
repository_name: 'your-repository-name'
dry_run: 'true'
days: '7'
Assuming you have doctl installed and authenticated with your user, you can run the following commands:
doctl registry login --expiry-seconds 1200
For help on the script:
./entrypoint.sh -h
To run the script in dry-run mode:
./entrypoint.sh -d -n <number of days> <repository-name>
To run the script:
./entrypoint.sh -n <number of days> <repository-name>
example:
./entrypoint.sh -n 1 myapp
Software: The software as it is licensed under the MIT License, please feel free to extend, re-use, share the code.