Automatically create a PR, bump version (using Commitizen), approve and merge (suitable for CI/CD).
Project description
pumper
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:
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
:
- 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. - Create a branch including changes from above step a push it.
- Create PR.
- 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
- Allow GitHub Actions to create and approve pull requests in your repository settings.
- Depending on which token you want to use:
-
Actions
GITHUB_TOKEN
needs following permissions:permissions: pull-requests: write contents: write
-
Github personal access tokens (classic) needs
public_repo
scope for public repositories or fullrepo
scope for a private repositories.
-
Appreciation
Big thanks ๐ to following libraries:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pumper-0.2.0.tar.gz
.
File metadata
- Download URL: pumper-0.2.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e849ce0b5657bbae8c250c12f6a3535265d973ddfd349afaeacc28a4a9cd0336 |
|
MD5 | 4f0658b3b7786847ac43f27ff244797b |
|
BLAKE2b-256 | f5c8785aec529fb69de489401bc02ce030f638e095c6758c248c8ea15323e049 |
File details
Details for the file pumper-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pumper-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f21b5256621ee6852d8241938ea46c472fe20b82d557965d1506415d806fb0 |
|
MD5 | 575083a7d7902b80689d5c31441a8ebd |
|
BLAKE2b-256 | ea2a14878234f6daa1091f50de57eb10ec7f0d001f1d82f730532df53c0b3787 |