This tool is designed to help manage and clean up artifacts in a GitHub repository. It deletes all artifacts associated with a given GitHub repository using the GitHub API.
Before you begin, ensure you have the following installed:
curl
: Used to make API calls to GitHub.jq
: Used to parse JSON data returned by API calls.
These tools are available on most Unix-like systems and can be installed using your system's package manager.
-
Clone the repository:
git clone https://github.com/yourusername/github-artifact-cleaner.git cd github-artifact-cleaner
-
Make the script executable:
chmod +x delete_github_artifacts.sh
To use the script, follow these steps:
-
Run the script:
./delete_github_artifacts.sh
-
Enter the GitHub repository URL: Follow the prompt to enter the repository URL, for example:
https://github.com/username/repository
-
Enter your GitHub token: You will need a GitHub token with appropriate permissions (i.e.,
repo
scope which includesrepo:status
,repo_deployment
,public_repo
,repo:invite
,security_events
,delete_repo
, andwrite:packages
).Follow the prompt to enter your token securely.
The script will then proceed to fetch and delete all artifacts, logging each action to the terminal.
Ensure that your GitHub token is kept secure. Do not share it in publicly accessible areas, and use environment variables or secure vaults to manage credentials in production environments.
This project is licensed under the MIT License - see the LICENSE file for details.