Application to determine and delete existing versions of GitHub packages. It uses GitHub rest api to get information of a package and its versions.
🐤 This repository is just a try out of GoLang and GitHub rest api
🚀 This application should be put to an GitHub Action at Ma-Vin/packages-action afterwards.
The application can handle versions of the type <major>.<minor>.<patch> or <major>.<minor>.<patch>-SNAPSHOT. If minor or patch are missing they will be handled as zero.
The application has to be configured by environment variables
Environment Variable | Required | Default | Description |
---|---|---|---|
GITHUB_REST_API_URL | https://api.github.com | Protocol and host of the GitHub rest api | |
GITHUB_ORGANIZATION | |||
GITHUB_USER | ✔️ | GitHub user who is the owner of the packages | |
PACKAGE_TYPE | ✔️ | The type of package. At the moment only maven is supported (In general there exists npm, maven, rubygems, docker, nuget, container) | |
PACKAGE_NAME | ✔️ | The name of the package whose versions should be deleted | |
VERSION_NAME_TO_DELETE | A concrete version to delete (Independent of NUMBER_MAJOR_TO_KEEP NUMBER_MINOR_TO_KEEP and NUMBER_PATCH_TO_KEEP) | ||
DELETE_SNAPSHOTS | false | Indicator whether to delete all snapshots or none (Snapshots are excluded from NUMBER_MAJOR_TO_KEEP NUMBER_MINOR_TO_KEEP and NUMBER_PATCH_TO_KEEP) | |
NUMBER_MAJOR_TO_KEEP | keep all | Positive number of major versions to keep | |
NUMBER_MINOR_TO_KEEP | keep all | Positive number of minor versions to keep (within a major version) | |
NUMBER_PATCH_TO_KEEP | keep all | Positive number of patch versions to keep (within a minor version) | |
GITHUB_TOKEN | ✔️ | The access token to use for bearer authentication against GitHub rest api | |
DRY_RUN | true | Indicator whether to print deletion candidates only or to delete versions/package | |
DEBUG_LOGS | false | Indicator whether to print more detail informations (At the moment not much additional) | |
REST_TIMEOUT | 3 | Timeout in seconds to use against GitHub Rest Api |
At least one deletion indicator of VERSION_NAME_TO_DELETE, DELETE_SNAPSHOTS, NUMBER_MAJOR_TO_KEEP NUMBER_MINOR_TO_KEEP or NUMBER_PATCH_TO_KEEP must be set