Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multi_repo_automation-1.0.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

multi_repo_automation-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file multi_repo_automation-1.0.0.tar.gz.

File metadata

  • Download URL: multi_repo_automation-1.0.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for multi_repo_automation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b76387ab5f14850f422c5ceda75abd89b1b451a1cdc272fdeab87cea495eff28
MD5 cf4ca5b7d2b2fa2415cc6ce493ff856d
BLAKE2b-256 4cdd62438f057b1a94c4fd2e23cae7cc960ffac16ef21abf2f01a05f55df8b94

See more details on using hashes here.

Provenance

File details

Details for the file multi_repo_automation-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for multi_repo_automation-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a261e6e99f123375bd511863b654a641a9289b6d3a4a40e9a8acf50223e212d
MD5 88126458edb12d45821b88c9afc4089b
BLAKE2b-256 a6a9d5992d7100cc299a11891434997854cbd4b45f3e18181239ea9279674b7f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page