Skip to content

Automagically ๐Ÿงšโ€โ™€๏ธ create branch, pull request, bump version (using Commitizen), approve and merge.

License

Notifications You must be signed in to change notification settings

aka-raccoon/pumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

pumper

PyPI - Version PyPI - Python Version code style - black types - mypy imports - isort

Automagically ๐Ÿงšโ€โ™€๏ธ create branch, pull request, bump version (using Commitizen), approve and merge.


pumper helps create CI/CD bump version jobs more secure ๐Ÿ‘ฎโ€โ™€๏ธ.

Common version bump strategy these days is to have CI/CD workflow run automatic version bump directly in a main branch:

common-bump-strategy

This raises following concerns (among others) in highly secured environments:

  • direct push to a main branch required
  • branch protection rules needs to be relieved
  • change in main branch is not reviewed

Bump strategy with pumper:

pumper-strategy

  1. Call great tool Commitizen. It checks your commit history and bumps your version. Check it out for more information how to configure and use it.
  2. Create a branch including changes from above step a push it.
  3. Create PR.
  4. Optionally approve a merge PR.

Quick install guide

pumper can be installed from PYPI. It's recommended to install it in isolated Python environment using venv.

python -m venv .venv
.venv/bin/pip install pumper

How to use it

Using CLI

pump create

 Usage: pumper create [OPTIONS]

 Bump version, push branch and create pull request.

โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  --repo            TEXT  The owner and repository name, eg 'owner/repo'.     โ”‚
โ”‚                            [env var: GITHUB_REPOSITORY]                        โ”‚
โ”‚                            [default: None]                                     โ”‚
โ”‚                            [required]                                          โ”‚
โ”‚    --url             TEXT  Github API url.                                     โ”‚
โ”‚                            [env var: GITHUB_API_URL]                           โ”‚
โ”‚                            [default: https://api.github.com]                   โ”‚
โ”‚ *  --token           TEXT  Github token.   [env var: GITHUB_TOKEN]             โ”‚
โ”‚                            [default: None] [required]                          โ”‚
โ”‚    --base            TEXT  Base branch of a PR. [env var: BASE_BRANCH]         โ”‚
โ”‚                            [default: main]                                     โ”‚
โ”‚    --branch          TEXT  Branch name and PR title.                           โ”‚
โ”‚                            [default: release/{version}]                        โ”‚
โ”‚    --user            TEXT  Git user name. [default: github-actions[bot]]       โ”‚
โ”‚    --email           TEXT  Git user email.                                     โ”‚
โ”‚                            [default:                                           โ”‚
โ”‚                            github-actions[bot]@users.noreply.github.com]       โ”‚
โ”‚    --gh-env                Create 'PR_NUM' env var for GH actions              โ”‚
โ”‚    --label           TEXT  Add labels to PR. [default: None]                   โ”‚
โ”‚    --assign                Assign PR [default: True]                           โ”‚
โ”‚    --assignee        TEXT  PR assignee name. [env var: GITHUB_ACTOR]           โ”‚
โ”‚    --help                  Show this message and exit.                         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

pumper approve

 Usage: pumper approve [OPTIONS] PR_NUM

 Approve pull request.

โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *    pr_num      INTEGER  PR number. [env var: PR_NUM] [default: None]         โ”‚
โ”‚                           [required]                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  --repo         TEXT  The owner and repository name, eg 'owner/repo'.        โ”‚
โ”‚                         [env var: GITHUB_REPOSITORY]                           โ”‚
โ”‚                         [default: None]                                        โ”‚
โ”‚                         [required]                                             โ”‚
โ”‚    --url          TEXT  Github API url.                                        โ”‚
โ”‚                         [env var: GITHUB_API_URL]                              โ”‚
โ”‚                         [default: https://api.github.com]                      โ”‚
โ”‚ *  --token        TEXT  Github token. [env var: GITHUB_TOKEN] [default: None]  โ”‚
โ”‚                         [required]                                             โ”‚
โ”‚    --body         TEXT  PR message. [default: ๐Ÿค– Approved by GH actions!]      โ”‚
โ”‚    --help               Show this message and exit.                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

pumper merge

 Usage: pumper merge [OPTIONS] PR_NUM

 Merge pull request.

โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *    pr_num      INTEGER  PR number. [env var: PR_NUM] [default: None]        โ”‚
โ”‚                           [required]                                          โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚    --method        [merge|squash|rebase]  The merge method to use.            โ”‚
โ”‚                                           [default: merge]                    โ”‚
โ”‚ *  --repo          TEXT                   The owner and repository name, eg   โ”‚
โ”‚                                           'owner/repo'.                       โ”‚
โ”‚                                           [env var: GITHUB_REPOSITORY]        โ”‚
โ”‚                                           [default: None]                     โ”‚
โ”‚                                           [required]                          โ”‚
โ”‚    --url           TEXT                   Github API url.                     โ”‚
โ”‚                                           [env var: GITHUB_API_URL]           โ”‚
โ”‚                                           [default: https://api.github.com]   โ”‚
โ”‚ *  --token         TEXT                   Github token.                       โ”‚
โ”‚                                           [env var: GITHUB_TOKEN]             โ”‚
โ”‚                                           [default: None]                     โ”‚
โ”‚                                           [required]                          โ”‚
โ”‚    --help                                 Show this message and exit.         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Github actions

See my GH actions bumper.yaml workflow. Replace pip install . with pip install pumper==0.2.0 (line 31).

Required setup

Appreciation

Big thanks ๐Ÿ™ to following libraries:

About

Automagically ๐Ÿงšโ€โ™€๏ธ create branch, pull request, bump version (using Commitizen), approve and merge.

Topics

Resources

License

Stars

Watchers

Forks

Languages