Multi repo automation
Configuration
To be able to apply your changes on multiple repository you should create a file with something like this:
- dir: /home/user/src/my-repo
name: user/my-repo
types: ['javascript', 'python', 'docker']
master_branch: master
stabilization_branches: [1.0, 1.1]
folders_to_clean: []
The main configuration is a YAML file ~/.config/multi-repo-automation.yaml with the following options:
repos_filename: the filename of the files with the repositories definitions create above, default is repos.yaml.
browser: the browser to use to open the pull requests, default is xdg-open.
editor: the editor to use to edit files, default is xdg-open.
Migration script base
#!/usr/bin/env python3
import multi_repo_automation as mra
def _do() -> None:
# Your actions
if __name__ == "__main__":
mra.main(
_do,
config={
# pull_request_on_stabilization_branches: To apply the action on all stabilization (including master) branches.
# pull_request_title: The pull request title.
# pull_request_body: The pull request body.
# branch: The created branch branch name.
# pull_request_branch_prefix: The created branch prefix (used when we run it on all the stabilization branches).
},
)
Use the --help option to see the available options.
Utilities
import multi_repo_automation as mra
# Test if a file exists
if mra.run(["git", "ls-files", "**/*.txt"], stdout=subprocess.PIPE).stdout.strip() != "":
print("Found")
# Get all YAML files:
mra.all_filenames_identify("yaml")
# Test if a file exists and contains a text
if mra.git_grep(file, r"\<text\>"]):
print("Found")
# Edit a files manually
mra.edit(["file"])
Edit file programmatically
with mra.Edit('my-file.txt') as edit:
edit.content = edit.content.replace('<from>', '<to>')
Edit YAML file programmatically
with mra.EditYAML('my-file.yaml') as edit:
edit.setdefault('dict', {})['prop'] = 'value'
Edit TOML file programmatically
with mra.EditTOML('my-file.toml') as edit:
edit.setdefault('dict', {})['prop'] = 'value'
Edit Config file programmatically
with mra.EditConfigL('my-file.ini') as edit:
edit.setdefault('dict', {})['prop'] = 'value'
Contributing
Install the pre-commit hooks:
pip install pre-commit
pre-commit install --allow-missing-config
Metadata
Release files for multi-repo-automation 1.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| multi_repo_automation-1.9.1.tar.gz | 27.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multi_repo_automation-1.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.8 kB
Release files / multi_repo_automation-1.9.1.tar.gz
| Download URL | multi_repo_automation-1.9.1.tar.gz |
|---|---|
| Size | 27.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
752f692313e5e58f192d731619facc466d1f186ccd8d0ac8a90cb085150fd7f9
|
|
BLAKE2b-256 checksum How to use checksums |
1cad502ebd2be08efbe60216b2b604b3278b6d903c2730c967f0b9799be7a408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / multi_repo_automation-1.9.1-py3-none-any.whl
| Download URL | multi_repo_automation-1.9.1-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5214483d336b9e9c2498ee85b196b4b7150aed943c2a3507a98468b737b1d652
|
|
BLAKE2b-256 checksum How to use checksums |
060d38170e03ceb8a93626a0bc74c6591b8f02d8a96bfe5ec522998310c47978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|