refactor: bper renamed to git-backporting

This commit is contained in:
Andrea Lamparelli 2023-07-06 13:44:23 +02:00
parent e66ad37eab
commit c5015ba254
4 changed files with 39 additions and 19 deletions

View file

@ -1,6 +1,5 @@
<h1 align="center"> <h1 align="center">
BPER </br> Git Backporting </br>
Git Backporter </br>
:outbox_tray: :inbox_tray: :outbox_tray: :inbox_tray:
</h1> </h1>
@ -8,18 +7,18 @@
<a href="https://github.com/kiegroup/git-backporting"> <a href="https://github.com/kiegroup/git-backporting">
<img alt="ci checks status" src="https://github.com/kiegroup/git-backporting/actions/workflows/ci.yml/badge.svg"> <img alt="ci checks status" src="https://github.com/kiegroup/git-backporting/actions/workflows/ci.yml/badge.svg">
</a> </a>
<a href="https://badge.fury.io/js/@kie%2Fbper"> <a href="https://badge.fury.io/js/@kie%git-backporting">
<img alt="npm version" src="https://badge.fury.io/js/@kie%2Fbper.svg"> <img alt="npm version" src="https://badge.fury.io/js/@kie%2Fgit-backporting.svg">
</a> </a>
</p> </p>
--- ---
## :bangbang: Starting from v4 bper has been moved under @kiegroup organization :bangbang: ## :bangbang: Starting from v4 git-backporting has been moved under @kiegroup organization and renamed :bangbang:
--- ---
**Git Backporter**, also referenced as **bper**, is a [NodeJS](https://nodejs.org/) command line tool that provides capabilities to *backport* pull requests (on *GitHub*) and merge requests (on *GitLab*) in an automated way. This tool also comes with a predefined *GitHub* action in order to make CI/CD integration easier for all users. **Git Backporting** is a [NodeJS](https://nodejs.org/) command line tool that provides capabilities to *backport* pull requests (on *GitHub*) and merge requests (on *GitLab*) in an automated way. This tool also comes with a predefined *GitHub* action in order to make CI/CD integration easier for all users.
Table of content Table of content
@ -31,12 +30,13 @@ Table of content
* **[GitHub action](#github-action)** * **[GitHub action](#github-action)**
* **[Future works](#future-works)** * **[Future works](#future-works)**
* **[Release](#release)** * **[Release](#release)**
* **[Repository migration](#repository-migration)**
* **[Contributing](#contributing)** * **[Contributing](#contributing)**
* **[License](#license)** * **[License](#license)**
## Who is this tool for? ## Who is this tool for?
`bper` is a tool that provides capabilities to *backport* pull requests (on *GitHub*) and merge requests (on *GitLab*) in an automated way. `git-backporting` is a tool that provides capabilities to *backport* pull requests (on *GitHub*) and merge requests (on *GitLab*) in an automated way.
> *What is backporting?* - backporting is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another. > *What is backporting?* - backporting is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
@ -47,24 +47,26 @@ Therefore this tools is for anybody who is working on projects where they have t
This tool is released on the [public npm registry](https://www.npmjs.com/), therefore it can be easily installed using `npm`: This tool is released on the [public npm registry](https://www.npmjs.com/), therefore it can be easily installed using `npm`:
```bash ```bash
$ npm install -g @kie/bper $ npm install -g @kie/git-backporting
``` ```
> **NOTE**: if you want to download version 3 or older you must use the older scope `@lampajr` instead of `@kie`. > **NOTE**: if you want to download version 3 or older you must use the older package name `@lampajr/bper` instead of `@kie/git-backporting`.
Then you just have to choose the pull request (or merge request on *Gitlab*) that you would like to backport and the target branch and the simply run the following command: Then you just have to choose the pull request (or merge request on *Gitlab*) that you would like to backport and the target branch and the simply run the following command:
```bash ```bash
$ bper -tb <branch> -pr <pull-request-url> -a <git-token> $ git-backporting -tb <branch> -pr <pull-request-url> -a <git-token>
``` ```
A real example could be the following one: A real example could be the following one:
```bash ```bash
$ bper -tb develop -pr https://github.com/kiegroup/git-backporting-example/pull/47 -a ***** $ git-backporting -tb develop -pr https://github.com/kiegroup/git-backporting-example/pull/47 -a *****
``` ```
This is the easiest invocation where you let the tool set / compute most of the backported pull request data. Obviously most of that data can be overridden with appropriate tool options, more details can be found in the [inputs](#inputs) section. This is the easiest invocation where you let the tool set / compute most of the backported pull request data. Obviously most of that data can be overridden with appropriate tool options, more details can be found in the [inputs](#inputs) section.
> **NOTE**: if you are still using version 3 or older you must use the older CLI tool name `bper` instead of `git-backporting`.
### Requirements ### Requirements
* Node 16 or higher, more details on Node can be found [here](https://nodejs.org/en). * Node 16 or higher, more details on Node can be found [here](https://nodejs.org/en).
@ -112,7 +114,7 @@ Keep in mind that its structue MUST match the [Args](src/service/args/args.types
## Supported git services ## Supported git services
Right now **bper** supports the following git management services: Right now **Git Backporting** supports the following git management services:
* ***GITHUB***: Introduced since the first release of this tool (version `1.0.0`). The interaction with this system is performed using [*octokit*](https://octokit.github.io/rest.js) client library. * ***GITHUB***: Introduced since the first release of this tool (version `1.0.0`). The interaction with this system is performed using [*octokit*](https://octokit.github.io/rest.js) client library.
* ***GITLAB***: This has been introduced since version `3.0.0`, it works for both public and private *GitLab* servers. The interaction with this service is performed using plain [*axios*](https://axios-http.com) requests. The *gitlab* api version that is used to make requests is `v4`, at the moment there is no possibility to override it. * ***GITLAB***: This has been introduced since version `3.0.0`, it works for both public and private *GitLab* servers. The interaction with this service is performed using plain [*axios*](https://axios-http.com) requests. The *gitlab* api version that is used to make requests is `v4`, at the moment there is no possibility to override it.
@ -241,6 +243,23 @@ In case we would like to perform a manual release, it would be enough to open a
Once the release preparion pull request got merged, run [Release package](.github/workflows/release.yml) workflow. Once the release preparion pull request got merged, run [Release package](.github/workflows/release.yml) workflow.
## Repository Migration
From version `v4.0.0` the project has been moved under [@kiegroup](https://github.com/kiegroup) organization. During this migration we changed some things that you should be aware of. I'll try to summarize them in the following table:
> **NOTE**: these changes did not affect the tool features.
| | **v4 (after migration)** | v3 or older (before migration) |
|-------------|--------------------------|--------------------------------|
| Owner | kiegroup | lampajr |
| Repository | git-backporting | backporting |
| NPM package | @kie/git-backporting | @lampajr/bper |
| CLI tool | git-backporting | bper |
So everytime you would use older version keep in mind of these changes.
> **REMARK**: since from capabilities point of view `v3.1.1` and `v4.0.0` are equivalent we would recommend to directly start using `v4`.
## Contributing ## Contributing
This is an open source project, and you are more than welcome to contribute :heart:! This is an open source project, and you are more than welcome to contribute :heart:!

2
dist/cli/index.js vendored
View file

@ -23331,7 +23331,7 @@ module.exports = axios;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = JSON.parse('{"name":"@kie/bper","version":"4.0.0","description":"BPer is a tool to execute automatic git backporting.","author":"","license":"MIT","private":false,"main":"./dist/gha/index.js","bin":{"bper":"./dist/cli/index.js"},"files":["dist/cli/index.js"],"scripts":{"prepare":"husky install","clean":"rm -rf ./build ./dist","compile":"tsc -p tsconfig.json && tsc-alias -p tsconfig.json","package":"npm run package:cli && npm run package:gha","package:cli":"ncc build ./build/src/bin/cli.js -o dist/cli","package:gha":"ncc build ./build/src/bin/gha.js -o dist/gha","build":"npm run clean && npm run compile && npm run package","test":"jest","test:report":"npm test -- --coverage --testResultsProcessor=jest-sonar-reporter","lint":"eslint . --ext .ts","lint:fix":"npm run lint -- --fix","ts-node":"ts-node","postversion":"npm run build && git add dist && rm -rf build","release":"release-it","release:branch":"git checkout -b release/$(release-it --release-version) main","release:prepare":"release-it --no-npm.publish --no-github.release --no-git.push --no-git.tag --no-git.requireUpstream","release:prepare:all":"npm run release:branch && npm run release:prepare"},"repository":{"type":"git","url":"git+https://github.com/kiegroup/git-backporting.git"},"keywords":["backporting","pull-requests","github-action","cherry-pick"],"bugs":{"url":"https://github.com/kiegroup/git-backporting/issues"},"homepage":"https://github.com/kiegroup/git-backporting#readme","devDependencies":{"@commitlint/cli":"^17.4.0","@commitlint/config-conventional":"^17.4.0","@gitbeaker/rest":"^39.1.0","@kie/mock-github":"^1.1.0","@release-it/conventional-changelog":"^5.1.1","@types/fs-extra":"^9.0.13","@types/jest":"^29.2.4","@types/node":"^18.11.17","@typescript-eslint/eslint-plugin":"^5.47.0","@typescript-eslint/parser":"^5.47.0","@vercel/ncc":"^0.36.0","eslint":"^8.30.0","husky":"^8.0.2","jest":"^29.0.0","jest-sonar-reporter":"^2.0.0","release-it":"^15.6.0","semver":"^7.3.8","ts-jest":"^29.0.0","ts-node":"^10.8.1","tsc-alias":"^1.8.2","tsconfig-paths":"^4.1.0","typescript":"^4.9.3","@octokit/webhooks-types":"^6.8.0"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^18.12.0","axios":"^1.4.0","commander":"^9.3.0","fs-extra":"^11.1.0","https":"^1.0.0","simple-git":"^3.15.1"}}'); module.exports = JSON.parse('{"name":"@kie/git-backporting","version":"4.0.0","description":"Git backporting is a tool to execute automatic pull request git backporting.","author":"","license":"MIT","private":false,"main":"./dist/gha/index.js","bin":{"git-backporting":"./dist/cli/index.js"},"files":["dist/cli/index.js"],"scripts":{"prepare":"husky install","clean":"rm -rf ./build ./dist","compile":"tsc -p tsconfig.json && tsc-alias -p tsconfig.json","package":"npm run package:cli && npm run package:gha","package:cli":"ncc build ./build/src/bin/cli.js -o dist/cli","package:gha":"ncc build ./build/src/bin/gha.js -o dist/gha","build":"npm run clean && npm run compile && npm run package","test":"jest","test:report":"npm test -- --coverage --testResultsProcessor=jest-sonar-reporter","lint":"eslint . --ext .ts","lint:fix":"npm run lint -- --fix","ts-node":"ts-node","postversion":"npm run build && git add dist && rm -rf build","release":"release-it","release:branch":"git checkout -b release/$(release-it --release-version) main","release:prepare":"release-it --no-npm.publish --no-github.release --no-git.push --no-git.tag --no-git.requireUpstream","release:prepare:all":"npm run release:branch && npm run release:prepare"},"repository":{"type":"git","url":"git+https://github.com/kiegroup/git-backporting.git"},"keywords":["backporting","pull-requests","merge-requests","github-action","cherry-pick"],"bugs":{"url":"https://github.com/kiegroup/git-backporting/issues"},"homepage":"https://github.com/kiegroup/git-backporting#readme","devDependencies":{"@commitlint/cli":"^17.4.0","@commitlint/config-conventional":"^17.4.0","@gitbeaker/rest":"^39.1.0","@kie/mock-github":"^1.1.0","@release-it/conventional-changelog":"^5.1.1","@types/fs-extra":"^9.0.13","@types/jest":"^29.2.4","@types/node":"^18.11.17","@typescript-eslint/eslint-plugin":"^5.47.0","@typescript-eslint/parser":"^5.47.0","@vercel/ncc":"^0.36.0","eslint":"^8.30.0","husky":"^8.0.2","jest":"^29.0.0","jest-sonar-reporter":"^2.0.0","release-it":"^15.6.0","semver":"^7.3.8","ts-jest":"^29.0.0","ts-node":"^10.8.1","tsc-alias":"^1.8.2","tsconfig-paths":"^4.1.0","typescript":"^4.9.3","@octokit/webhooks-types":"^6.8.0"},"dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^18.12.0","axios":"^1.4.0","commander":"^9.3.0","fs-extra":"^11.1.0","https":"^1.0.0","simple-git":"^3.15.1"}}');
/***/ }), /***/ }),

6
package-lock.json generated
View file

@ -1,11 +1,11 @@
{ {
"name": "@kie/bper", "name": "@kie/git-backporting",
"version": "4.0.0", "version": "4.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@kie/bper", "name": "@kie/git-backporting",
"version": "4.0.0", "version": "4.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -18,7 +18,7 @@
"simple-git": "^3.15.1" "simple-git": "^3.15.1"
}, },
"bin": { "bin": {
"bper": "dist/cli/index.js" "git-backporting": "dist/cli/index.js"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.4.0", "@commitlint/cli": "^17.4.0",

View file

@ -1,13 +1,13 @@
{ {
"name": "@kie/bper", "name": "@kie/git-backporting",
"version": "4.0.0", "version": "4.0.0",
"description": "BPer is a tool to execute automatic git backporting.", "description": "Git backporting is a tool to execute automatic pull request git backporting.",
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"private": false, "private": false,
"main": "./dist/gha/index.js", "main": "./dist/gha/index.js",
"bin": { "bin": {
"bper": "./dist/cli/index.js" "git-backporting": "./dist/cli/index.js"
}, },
"files": [ "files": [
"dist/cli/index.js" "dist/cli/index.js"
@ -38,6 +38,7 @@
"keywords": [ "keywords": [
"backporting", "backporting",
"pull-requests", "pull-requests",
"merge-requests",
"github-action", "github-action",
"cherry-pick" "cherry-pick"
], ],