Library for automation updates on multiple repositories.
Project description
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
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file multi_repo_automation-1.4.2.tar.gz
.
File metadata
- Download URL: multi_repo_automation-1.4.2.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d980fd7511b19f8b42d4ce2309dfb674c97a8e57d4a960933a8b74e71a32180 |
|
MD5 | 1bdcfa4e2a400983aa4e01947c5219d8 |
|
BLAKE2b-256 | 764a9796aa1280d75737fb341f2b99f16cc653fa6b5466914d0538db280d5ff4 |
File details
Details for the file multi_repo_automation-1.4.2-py3-none-any.whl
.
File metadata
- Download URL: multi_repo_automation-1.4.2-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca5aac915db9f031bbe2a252b13997ee75da76dc0defeb84f8278a6ce26401f |
|
MD5 | d277191de4f7568c87454a8f393d1443 |
|
BLAKE2b-256 | c978bf905d32c2a11621bc643c35b350dee798154655669dc4b6f068b1c1221a |