Giter VIP home page Giter VIP logo

auto-pr's Introduction

auto-pr logo

CI Publish PyPI version PyPI downloads Code style: black

auto-pr

A command line tool to perform bulk updates across multiple GitHub repositories.

How to install

With pipx (recommended):

pipx install auto-pr

With pip:

pip install auto-pr

Usage

Usage

Init

First initialise the project directory by running the init command within an empty directory.

auto-pr init --api-key=<github_token> --ssh-key-file=<path-to-ssh-key>

Where <github_token> is a GitHub personal access token which has repo and user:user:email scope.

Next modify the generated config.yaml file with your desired configurations.

credentials:
  api_key: <github_token>
  ssh_key_file: /path/to/ssh/key/to/push/.ssh/id_rsa
pr:
  body: >
    Body of the PR that will be generated

    Can be multi-line :)
  branch: auto-pr # The branch name to use when making changes
  message: Replace default pipelines with modules # Commit message
  title: 'My awesome change' # Title of the PR
repositories: # Rules that define what repos to update
  - mode: add
    match_owner: <org/user>
update_command:
  - touch
  - my-file

Repositories

You can define the list of repositories to pull and build into the database to update using a list of rules.

  • mode - either add or remove - used to either match or negate
  • public (optional) - pull only public or private, leave out for both
  • archived (optional) - archived or non-archived, leave out for both
  • match_owner (optional) - the owner or user to pull
  • match_name (optional) - a list of regular expressions to match against to pull

The flags of the filter rules are optional not specifying will run the command on all repositories that the token has access too.

Update Command

This is the list containing the command to be executed along with the arguments passed to it. It will be executed from the root of each repository that is processed.

If an error occurs during the execution it will be displayed in the output but will not halt the execution.

See example commands

Pull

After you have configured the project you can now pull the repositories down that match your rules.

auto-pr pull

This will generate a db.json file within your workdir containing a list of mapped repositories and their state.

This command can be run multiple times, if there are new matching repositories found they will be merged into the existing database.

Test

Once the pull command has finished setting up the work directory you can now run test to check what the changes that will be made by the script will yield.

Run

When you're confident with the changes output from the test command you can finally execute run.

auto-pr run

This will perform the changes to a branch on the locally cloned repository and push the branch upstream with the information you provided within config.yaml.

See --help for more information about other commands and their usage.

Reset

You can reset the list of repos in db.json using auto-pr reset all, or auto-pr reset from FILE

When using auto-pr reset from FILE, the list of repos should be provided as a newline separated list of repos like <owner>/<name>, e.g:

getyourguide/test
getyourguide/auto-pr

Security

For sensitive security matters please contact [email protected].

Legal

Copyright 2021 GetYourGuide GmbH.

auto-pr is licensed under the Apache License, Version 2.0. See LICENSE for the full text.

auto-pr's People

Contributors

alexef avatar ctbur avatar dependabot[bot] avatar harshal-shah avatar inverse avatar lidijac avatar smeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

auto-pr's Issues

New command for adding repositories

It would be great if there was a new command that could leverage the GitHub API code search endpoint to map matched repositories.

For example a use case could be finding all repositories belonging to an organisation that contain a file.

The end result would be the configuration would be updated to reflect that addition or deletion.

Assign a reviewer even if the repo doesn't define `CODEOWNERS`

Right now, the service only assign a reviewer to the generated PR if the repo contains a CODEOWNERS file. It would be great if the PRs would also get assigned in the absence of CODEOWNERS. One option would be to look up the last PR author/reviewer, and use that user as a fallback.

Mark empty repositories as done

I've noticed situations where empty repositories are fetched which auto-pr handles gracefully however these are consistency run when you stop/start.

We should perhaps flag these as done to avoid them being processed over and over.

Or perhaps we need a state machine

Support GPG signed comments

Right now if you try to run with gpg signing enabled in your .gitconfig it will raise

b'error: gpg failed to sign the data\nfatal: failed to write commit object\

We should support this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.