Skip to main content

Library for automation updates on multiple repositories.

Project description

Multi repo automation

Config

Create a file with something like this:

- dir: /home/user/src/myrepo
  name: user/myrepo
  types: ['javascript', 'python', 'docker']
  master_branch: master
  stabilization_branches: [1.0, 1.1]
  folders_to_clean: []

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 file in vscode
mra.edit("file")

Genenric run

#!/usr/bin/env python3
import multi_repo_automation as mra


def _do() -> None:
    # Do something
    pass

if __name__ == "__main__":
    mra.main(_do)

In the _do function do the changes you want in your repo.

Use the --help option to see the available options.

To update all the master branches write a script like

#!/usr/bin/env python3
import multi_repo_automation as mra

def _do() -> None:
    # Do something
    pass

if __name__ == "__main__":
    mra.main(
        _do,
        os.path.join(os.path.dirname(__file__), "repo.yaml"),
        "/home/sbrunner/bin/firefox/firefox",
        config={
            "pull_request_branch": "branch_name",
            "pull_request_title": "Commit/Pull request message",
            "pull_request_body": "Optional body",
        },
    )

To update all the stabilization branches write a script like

#!/usr/bin/env python3
import multi_repo_automation as mra

def _do() -> None:
    # Do something
    pass

if __name__ == "__main__":
    mra.main(
        _do,
        os.path.join(os.path.dirname(__file__), "repo.yaml"),
        "/home/sbrunner/bin/firefox/firefox",
        config={
            "pull_request_on_stabilization_branches": True,
            "pull_request_branch_prefix": "prefix",
            "pull_request_title": "Commit/Pull request message",
            "pull_request_body": "Optional body",
        },
    )

Configuration

The 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, default is repos.yaml. browser: the browser to use to open the pull requests, default is xdg-open.

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-0.2.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

multi_repo_automation-0.2.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for multi_repo_automation-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5be24c6b475fad35027d25d9b8f7fba5f99e192b283d4720b89407eca7b6faac
MD5 66524f36fc2927c1ceefd56de3c45f95
BLAKE2b-256 7f8b4e9b8cc58de4b982529b9c24f7156f9fb6f73e55ccc43f6e7c5febf96b61

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for multi_repo_automation-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c100873b651e57f3aded10b87786e1094ed2729462327720d709742b13973e8
MD5 3121070c307637156ed4331491d9db22
BLAKE2b-256 9809a01e0b32618c926b7de6e39fc29427e3a880ac3c0153b93ee80421dbffe4

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