git-multi-repo-updater is a command line tool for updating multiple GitLab or GitHub repositories with a single command.
Project description
git-multi-repo-updater
is a command line tool for updating multiple GitLab or GitHub repositories with a single command.
Usage
Generate an access token at GitLab or GitHub and set it as environment variable:
export GITLAB_ACCESS_TOKEN=<token>
export GITHUB_OAUTH_TOKEN=<token>
export GIT_TOKEN=<token> # This one is used if previous ones are not found
Provide a list of repositories and a script or a command to run inside each of them:
./git-multi-repo-updater --repos repos.txt update_repo.py
Where repos.txt
could be:
https://gitlab.com/<handle>/<repo-title>
https://gitlab.com/<handle>/<repo-title2>
https://github.com/<handle>/<repo-title>
Try it yourself:
./git-multi-repo-updater \
--repo https://github.com/<handle>/<repo-title> \
--branch-name add-hello-world-file \
--commit-message "Add hello-world.txt file" \
touch hello-world.txt
These steps will be executed for each specified repository:
- The repository will be cloned into
/tmp/
directory. - A new branch will be created or fetched if it already exists.
- The command or a script will be executed inside the repository.
- A commit containing all the changes will be created.
- Newly created commit will be pushed to remote repository.
- A pull request will be created.
- [optional] A comment will be left next to the PR.
- [optional] The pull request will be merged.
These options could be used to specify more details:
Option | Description | Type | Required |
---|---|---|---|
--branch-name |
A name of a branch which will be created or used to add a commit and to create pull request from. | String | Yes |
--commit-message |
A commit message which will be used for all of the changes made. | String | No |
--repo |
Link to repository | String | No |
--repos |
Filename which contains a list of repository links | String | No |
Efficiency
git-multi-repo-updater
is implemented in Python and uses coroutines to make multiple parallel API calls. Delays are being made after each API call in order not to get throttled.
Roadmap
- Make API calls to GitHub
- Package and release to PyPi
- Run command as command line tool
- Stand-alone executable file download in Github releases.
- Make API calls to GitLab
- Support different API calls
- Advanced features:
- Merge PRs which have all requirements like approvals met.
Development
make venv
- will create virtual env with dev dependencies.
make check
- will run Flake8, MyPy and PyTest checks.
Related projects
This tool was inspired by:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for git_multi_repo_updater-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b9067f1ee707f21f6425da8eb4a5b327abc52512bd3f0028b22c5c4ea015b2b |
|
MD5 | a177766f872631c4c60d7d49722aaf6c |
|
BLAKE2b-256 | 5ea106020f867cc5f56bfb63a0be9d9460c10526666d78d00514ff76e1a567da |
Hashes for git_multi_repo_updater-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9856ba7a22f59777b7e73aebe323415f9cb0ecd401d14108501e6bb212c55c70 |
|
MD5 | 6d1a4331d9feb05992b18aa862045340 |
|
BLAKE2b-256 | 7eef27fa2c77c975fb7eff759cb98305337f025d7bda1ae5ebc56d6865b2522f |