跳转到主要内容

多个仓库自动化更新库。

项目描述

多仓库自动化

配置

要能够在多个仓库上应用您的更改,您应该创建一个类似于以下内容的文件

- 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: []

主要配置是一个YAML文件 ~/.config/multi-repo-automation.yaml,包含以下选项

repos_filename:上面创建的包含仓库定义的文件的名称,默认为repos.yamlbrowser:用于打开拉取请求的浏览器,默认为xdg-openeditor:用于编辑文件的编辑器,默认为xdg-open

迁移脚本基础

#!/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).
        },
    )

使用--help选项查看可用选项。

实用工具

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"])

程序化编辑文件

   with mra.Edit('my-file.txt') as edit:
      edit.content = edit.content.replace('<from>', '<to>')

程序化编辑YAML文件

   with mra.EditYAML('my-file.yaml') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'

程序化编辑TOML文件

   with mra.EditTOML('my-file.toml') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'

程序化编辑配置文件

   with mra.EditConfigL('my-file.ini') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'

贡献

安装pre-commit钩子

pip install pre-commit
pre-commit install --allow-missing-config

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪一个,请了解有关 安装软件包 的更多信息。

源代码分发

multi_repo_automation-1.3.0.tar.gz (20.3 kB 查看哈希值)

上传时间 源代码

构建分发

multi_repo_automation-1.3.0-py3-none-any.whl (21.3 kB 查看哈希值)

上传时间 Python 3