A Python tool for bulk adding repositories to Codacy and configuring their integration settings. This utility helps automate the process of onboarding multiple repositories to Codacy's code quality platform.
- 📦 Bulk Repository Addition: Add multiple repositories to Codacy from a simple text file
- 🔧 Integration Settings Configuration: Automatically configure repository integration settings
- 🌐 Multiple Provider Support: Works with GitHub (gh) and GitHub Enterprise (ghe)
- ⚡ Rate Limiting: Built-in delays to respect API rate limits
- 🛡️ Error Handling: Comprehensive error handling with detailed feedback
- 🏢 Organization Support: Add repositories under specific organizations
- Python 3.6+
requests
library (see requirements.txt)- Codacy API token with appropriate permissions
- Clone this repository:
git clone <repository-url>
cd repository-adder
- Install dependencies:
pip install -r requirements.txt
python main.py --token YOUR_API_TOKEN --file repositories.txt --provider gh --organization your-org
Parameter | Required | Description | Default |
---|---|---|---|
--token |
✅ | Codacy API token | - |
--file |
✅ | Path to text file containing repository names | - |
--provider |
✅ | Git provider (gh for GitHub, ghe for GitHub Enterprise) |
- |
--organization |
✅ | Organization name | - |
--baseurl |
❌ | Codacy server address | https://app.codacy.com |
Create a text file with one repository name per line:
repository-name-1
repository-name-2
my-awesome-project
another-repo
Adding repositories to Codacy Cloud:
python main.py --token abc123def456 --file repos.txt --provider gh --organization organization
Adding repositories to Codacy Self-hosted:
python main.py --token abc123def456 --file repos.txt --provider ghe --organization my-org --baseurl https://codacy.mycompany.com
The tool automatically configures the following integration settings for each repository:
- ❌ Commit Status: Disabled
- ❌ Pull Request Comments: Disabled
- ❌ Pull Request Summary: Disabled
- ❌ Coverage Summary: Disabled
- ❌ Suggestions: Disabled
- ❌ AI Enhanced Comments: Disabled
To modify these settings, edit the data
object in the update_repository_integrations_settings
function.
The tool handles various scenarios gracefully:
- 409 Conflict: Repository already exists (non-fatal)
- API Errors: Network issues, authentication failures, etc.
- Rate Limiting: 2-second delay between requests
POST /api/v3/repositories
- Add repositoryPATCH /api/v3/organizations/{provider}/{organization}/repositories/{repository}/integrations/providerSettings
- Update integration settings
- Log in to your Codacy instance
- Go to Account Settings → API Tokens
- Generate a new token with repository management permissions
- Copy the token for use with this tool
Authentication Error (401)
- Verify your API token is correct and has sufficient permissions
Repository Already Exists (409)
- This is expected behavior when a repository is already added to Codacy
- The tool will skip these repositories and continue processing
Rate Limiting (429)
- The tool includes automatic delays, but you may need to adjust the sleep time in
process_files()
For detailed debugging, you can modify the script to print response details:
print(f"Response Status: {response.status_code}")
print(f"Response Body: {response.text}")
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
[Add your license information here]
For issues and questions:
- Check the troubleshooting section
- Review Codacy's API documentation
- Open an issue in this repository
Note: This tool is designed for bulk operations. For single repository additions, consider using the Codacy web interface.