autogit 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:
autogit --repos repos.txt update_repo.py
Where repos.txt could be:
https://gitlab.com/<handle>/<repo-title>
https://gitlab.com/<handle>/<repo-title2>.git
https://gitlab.com/<group>/<namespace>/<repo-title3>
https://github.com/<handle>/<repo-title4>
https://yourmanagedgit.com/<handle>/<repo-title5>
# https://yourmanagedgit.com/<handle>/<repo-title6> - this line is commented out
Try it yourself:
autogit \
--repo https://github.com/<handle>/<repo-title> \
--branch=add-hello-world-file \
--clone-to=tmp \
--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
add-hello-world-filewill 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 |
A name of a branch which will be used to commit changes to and to create Pull Request from (this branch will be created if it does not exist) | String | Yes |
--source-branch |
Base branch which will be used as a basis for a new branch creation. Target branch will be used by default. | String | No |
--target-branch |
Branch to be used as a target in a Pull Request. | String | No |
--commit-message |
A commit message which will be used for all of the changes made. | String | No |
--clone-to |
Path to temporal directory which will be used to clone repositories to | String | No |
--repo |
Link to repository | String | No |
--repos |
Filename which contains a list of repository links | String | No |
--merge |
Merge PR by skipping CI pipeline and other checks | Boolean | No |
--merge-on-success |
Set auto merge flag that automatically merges the PR when CI pipeline succeeds | Boolean | No |
Options to be added in the future releases:
| Option | Description | Type | Required |
| --pr-title | Title of the Pull Request (commit message is used by default) | String | No |
| --pr-description | Pull Request description in Markdown format (empty by default) | String | No |
| --pr-reviewers | Comma separated list of usernames to assign as reviewers in newly created Pull Requests | String | No |
| --stop-on-failure | Exits immediately when an issue for at least one repo is detected (tries to create any possible PR by default, even if some repos failed to be processed) | Boolean | No |
| --max-api-concurrency | Max number of concurrent API requests (default 2) | Int | No |
More examples:
autogit --repos repos.txt ./examples/update_mypy_version.py
Efficiency
autogit 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
-
Add unit tests for all the paths (mock gitpython, httpx requests)
- Implement state change dependencies on the tests.
- Implement RecorderMock for packages.
-
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:
Metadata
Release files for autogit 0.0.48
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autogit-0.0.48.tar.gz | 18.2 kB | Without provenance | Details for autogit-0.0.48.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autogit-0.0.48-py3-none-any.whl | Python 3 | none | any | Details for autogit-0.0.48-py3-none-any.whl |
Total release size: 42.8 kB
Release files / autogit-0.0.48.tar.gz
| Download URL | autogit-0.0.48.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
691bf44ab2b95d9ab89eecf96c500b86c753f37fe798cbbffde8cd369b88911a
|
|
BLAKE2b-256 checksum How to use checksums |
d4afb5a41c9f699eb48829ff3a5c6c94f4e2998270e2ddb450b70b8bd7ac0b56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / autogit-0.0.48-py3-none-any.whl
| Download URL | autogit-0.0.48-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c36416c92f5cdffd324542db4ba618a723125a9f5cfd051e194b9019b11089e3
|
|
BLAKE2b-256 checksum How to use checksums |
8ade06f1d945530e661c9590a5fa6abe6ec5a4c0f2a955fa2bff5baa9d9c5ae7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Security for autogit 0.0.48
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.