Gitea Release Attachments Cleaner
A Node.js script to manage and clean up release attachments in Gitea repositories. This tool helps maintain repository size by keeping only the N most recent release attachments and removing older ones.
Prerequisites
- Node.js installed on your system
- Access to a Gitea instance
- Personal access token with repository access permissions
Configuration
Edit the config
object in index.js
:
const config = {
GITEA_URL: "https://git.zeldon.ru",
GITEA_TOKEN: "", // Your Gitea personal access token
REPO_OWNER: "", // Repository owner (user or organization)
REPO_NAME: "", // Repository name
KEEP_LAST_N: 10, // Number of latest attachments to keep
};
Usage
- Clone this repository
- Run the script:
node index.js
The script will:
- List all attachments and their total size
- Show how many attachments will be kept and deleted
- Ask for confirmation before deletion
- Delete the selected attachments and show progress
Example output:
Found 25 total attachments (156.78 MB)
Keeping 10 most recent attachments (52.30 MB)
15 attachments will be deleted (104.48 MB)
Do you want to proceed with deletion? (y/N)
Description
Languages
JavaScript
100%