项目作者: lf-

项目描述 :
Program that mass renames GitHub branches to `main`
高级语言: Python
项目地址: git://github.com/lf-/splice_graft.git
创建时间: 2020-06-13T09:37:04Z
项目社区:https://github.com/lf-/splice_graft

开源协议:MIT License

下载


splice graft 🌿

This is a tool to do various operations on the GitHub API.

Usage

Installation

You can install for usage with pip install --user https://github.com/lf-/splice_graft/archive/refs/heads/main.zip

or for development with pip install --user -e . in a clone of the repository.

Supported operations

  1. » python splice_graft.py --help
  2. usage: splice_graft.py [-h] {list,find_pr,set} ...
  3. positional arguments:
  4. {list,find_pr,set}
  5. list List non-archived repositories with the `master` default branch
  6. find_pr Finds a pull request touching the specified files
  7. set Sets some attributes on a set of repositories (from stdin)
  8. options:
  9. -h, --help show this help message and exit

Finding a PR touching some file

  1. # find any open PR touching both filename1 and filename2
  2. » splice-graft find_pr owner/repo filename1 filename2
  3. # find a closed or merged PR touching filename1
  4. » splice-graft find_pr -s closed -s merged owner/repo filename1
  5. # find a closed or merged PR touching anything under blah/
  6. » splice-graft find_pr -s closed -s merged -m re gankra/gankra.github.io '^blah/.*'
  7. # find a PR of any status touching anything under blah/
  8. » splice-graft find_pr -s any -m re gankra/gankra.github.io '^blah/.*'

Renaming branches

This tool helps you change the default branch on a bunch of GitHub repos to
main or another name. It creates a new branch using the GitHub API and sets
the default branch to it. This tool does not change your client side git
configs and branches, which need to be updated with git branch -m main and
git branch -u origin/main on your clones.

  1. $ # Grab an access token with scope 'repos' for your GitHub user account at https://github.com/settings/tokens
  2. $ export GH_ACCESS_TOKEN='abcdef'
  3. $ ./splice_graft.py list > repos.txt
  4. $ # Now, go through the repository list and remove any that you don't want to use
  5. $ ./splice_graft.py fix < repos.txt

Project information

This project is licensed under the MIT License. Everyone is expected to follow
the Contributor Covenant code of conduct while participating in this project.