From 15b6dd63ec41d3e82c5dd2b666a652658f8016d1 Mon Sep 17 00:00:00 2001 From: Andrea Lamparelli Date: Thu, 6 Jul 2023 14:19:04 +0200 Subject: [PATCH] refactor: transfer to kiegroup organization (#46) * refactor: moved to @kiegroup organization Starting from v4 the package/project has been moved under @kiegroup organization. * chore: release v4.0.0 * refactor: bper renamed to git-backporting --- CHANGELOG.md | 38 +++++++++------- README.md | 55 ++++++++++++++++------- action.yml | 2 +- dist/cli/index.js | 14 +++--- dist/gha/index.js | 10 ++--- package-lock.json | 10 ++--- package.json | 15 ++++--- src/service/args/cli/cli-args-parser.ts | 2 +- src/service/git/git-cli.ts | 2 +- src/service/git/github/octokit-factory.ts | 2 +- src/service/git/gitlab/gitlab-client.ts | 6 +-- 11 files changed, 91 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 708c417..d5e3679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,58 +1,62 @@ # Changelog -## [3.1.1](https://github.com/lampajr/backporting/compare/v3.1.0...v3.1.1) (2023-07-06) +## [4.0.0](https://github.com/kiegroup/git-backporting/compare/v3.0.0...v4.0.0) (2023-07-06) -## [3.1.0](https://github.com/lampajr/backporting/compare/v3.0.0...v3.1.0) (2023-07-05) +Project moved under @kiegroup organization. + +## [3.1.1](https://github.com/kiegroup/git-backporting/compare/v3.1.0...v3.1.1) (2023-07-06) + +## [3.1.0](https://github.com/kiegroup/git-backporting/compare/v3.0.0...v3.1.0) (2023-07-05) ### Features -* config file as option ([#42](https://github.com/lampajr/backporting/issues/42)) ([5ead31f](https://github.com/lampajr/backporting/commit/5ead31f606b585ecdf7ed2e9de8ebd841b935898)) +* config file as option ([#42](https://github.com/kiegroup/git-backporting/issues/42)) ([5ead31f](https://github.com/kiegroup/git-backporting/commit/5ead31f606b585ecdf7ed2e9de8ebd841b935898)) -## [3.0.0](https://github.com/lampajr/backporting/compare/v2.2.1...v3.0.0) (2023-07-01) +## [3.0.0](https://github.com/kiegroup/git-backporting/compare/v2.2.1...v3.0.0) (2023-07-01) ### Features -* integrate tool with gitlab service ([#39](https://github.com/lampajr/backporting/issues/39)) ([107f5e5](https://github.com/lampajr/backporting/commit/107f5e52d663157145aa14f6cf7fa4d6704cb844)) +* integrate tool with gitlab service ([#39](https://github.com/kiegroup/git-backporting/issues/39)) ([107f5e5](https://github.com/kiegroup/git-backporting/commit/107f5e52d663157145aa14f6cf7fa4d6704cb844)) ### Bug Fixes -* removed 'powered by..' pr body suffix ([6869bec](https://github.com/lampajr/backporting/commit/6869becb3e5979b24f6fe29bf38141e15c1bdc66)) +* removed 'powered by..' pr body suffix ([6869bec](https://github.com/kiegroup/git-backporting/commit/6869becb3e5979b24f6fe29bf38141e15c1bdc66)) -## [2.2.1](https://github.com/lampajr/backporting/compare/v2.2.0...v2.2.1) (2023-06-27) +## [2.2.1](https://github.com/kiegroup/git-backporting/compare/v2.2.0...v2.2.1) (2023-06-27) ### Bug Fixes -* fix gha no-inherit-reviewers input ([8b586cc](https://github.com/lampajr/backporting/commit/8b586ccdfe0e6b90ed41ea8a5eecdbc24893fe25)) +* fix gha no-inherit-reviewers input ([8b586cc](https://github.com/kiegroup/git-backporting/commit/8b586ccdfe0e6b90ed41ea8a5eecdbc24893fe25)) -## [2.2.0](https://github.com/lampajr/backporting/compare/v2.1.0...v2.2.0) (2023-06-22) +## [2.2.0](https://github.com/kiegroup/git-backporting/compare/v2.1.0...v2.2.0) (2023-06-22) ### Features -* override backporting pr fields ([#38](https://github.com/lampajr/backporting/issues/38)) ([a32e8cd](https://github.com/lampajr/backporting/commit/a32e8cd34c757358668fe8f88f6d1733d3fa8391)) +* override backporting pr fields ([#38](https://github.com/kiegroup/git-backporting/issues/38)) ([a32e8cd](https://github.com/kiegroup/git-backporting/commit/a32e8cd34c757358668fe8f88f6d1733d3fa8391)) -## [2.1.0](https://github.com/lampajr/backporting/compare/v2.0.1...v2.1.0) (2023-06-20) +## [2.1.0](https://github.com/kiegroup/git-backporting/compare/v2.0.1...v2.1.0) (2023-06-20) ### Features -* **issue-17:** override backporting pr data ([#29](https://github.com/lampajr/backporting/issues/29)) ([941beda](https://github.com/lampajr/backporting/commit/941beda208e4a8c1577bd4d39299fbbfbf569c06)) +* **issue-17:** override backporting pr data ([#29](https://github.com/kiegroup/git-backporting/issues/29)) ([941beda](https://github.com/kiegroup/git-backporting/commit/941beda208e4a8c1577bd4d39299fbbfbf569c06)) ### Bug Fixes -* gha input parser ([95b35aa](https://github.com/lampajr/backporting/commit/95b35aa4efb86e2bc4990d920feec1ec5c4eb8e4)) +* gha input parser ([95b35aa](https://github.com/kiegroup/git-backporting/commit/95b35aa4efb86e2bc4990d920feec1ec5c4eb8e4)) -## [2.0.1](https://github.com/lampajr/backporting/compare/v2.0.0...v2.0.1) (2023-01-05) +## [2.0.1](https://github.com/kiegroup/git-backporting/compare/v2.0.0...v2.0.1) (2023-01-05) -## [2.0.0](https://github.com/lampajr/backporting/compare/v1.0.0...v2.0.0) (2023-01-05) +## [2.0.0](https://github.com/kiegroup/git-backporting/compare/v1.0.0...v2.0.0) (2023-01-05) ### Features -* backport still open pull requests ([b3936e0](https://github.com/lampajr/backporting/commit/b3936e019a19976281c5e2582904264e974b8b42)) -* pull request backporting ([b3936e0](https://github.com/lampajr/backporting/commit/b3936e019a19976281c5e2582904264e974b8b42)) \ No newline at end of file +* backport still open pull requests ([b3936e0](https://github.com/kiegroup/git-backporting/commit/b3936e019a19976281c5e2582904264e974b8b42)) +* pull request backporting ([b3936e0](https://github.com/kiegroup/git-backporting/commit/b3936e019a19976281c5e2582904264e974b8b42)) \ No newline at end of file diff --git a/README.md b/README.md index c555042..2393f6f 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,24 @@

- BPER
- Git Backporter
+ Git Backporting
:outbox_tray: :inbox_tray:

- - ci checks status + + ci checks status - - npm version + + npm version

--- -## :tada: BPER v3 is out!! You can backport Gitlab merge requests now :tada: +## :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 @@ -31,12 +30,13 @@ Table of content * **[GitHub action](#github-action)** * **[Future works](#future-works)** * **[Release](#release)** +* **[Repository migration](#repository-migration)** * **[Contributing](#contributing)** * **[License](#license)** ## 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. @@ -47,22 +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`: ```bash -$ npm install -g @lampajr/bper +$ npm install -g @kie/git-backporting ``` +> **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: ```bash -$ bper -tb -pr -a +$ git-backporting -tb -pr -a ``` A real example could be the following one: ```bash -$ bper -tb develop -pr https://github.com/lampajr/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. +> **NOTE**: if you are still using version 3 or older you must use the older CLI tool name `bper` instead of `git-backporting`. + ### Requirements * Node 16 or higher, more details on Node can be found [here](https://nodejs.org/en). @@ -77,7 +81,7 @@ This tool comes with some inputs that allow users to override the default behavi | Version | -V, --version | - | Current version of the tool | | | Help | -h, --help | - | Display the help message | | | Target Branch | -tb, --target-branch | N | Branch where the changes must be backported to | | -| Pull Request | -pr, --pull-request | N | Original pull request url, the one that must be backported, e.g., https://github.com/lampajr/backporting/pull/1 | | +| Pull Request | -pr, --pull-request | N | Original pull request url, the one that must be backported, e.g., https://github.com/kiegroup/git-backporting/pull/1 | | | Configuration File | -cf, --config-file | N | Configuration file, in JSON format, containing all options to be overridded, note that if provided all other CLI options will be ignored | | | Auth | -a, --auth | N | `GITHUB_TOKEN`, `GITLAB_TOKEN` or a `repo` scoped [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) | "" | | Folder | -f, --folder | N | Local folder full name of the repository that will be checked out, e.g., /tmp/folder | {cwd}/bp | @@ -110,7 +114,7 @@ Keep in mind that its structue MUST match the [Args](src/service/args/args.types ## 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. * ***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. @@ -147,7 +151,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Backporting - uses: lampajr/backporting@main + uses: kiegroup/git-backporting@main with: target-branch: ${{ inputs.targetBranch }} pull-request: ${{ inputs.pullRequest }} @@ -186,7 +190,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Backporting - uses: lampajr/backporting@main + uses: kiegroup/git-backporting@main with: target-branch: v1 pull-request: ${{ github.event.pull_request.url }} @@ -239,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. +## 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 This is an open source project, and you are more than welcome to contribute :heart:! @@ -247,7 +268,7 @@ Every change must be submitted through a *GitHub* pull request (PR). Backporting > **Note**: this project follows [git-conventional-commits](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13) standards, thanks to the [commit-msg hook](./.husky/commit-msg) you are not allowed to use commits that do not follow those standards. -1. Fork it (https://github.com/lampajr/backporting). +1. Fork it (https://github.com/kiegroup/git-backporting). 2. Create your feature branch: (git checkout -b feature). diff --git a/action.yml b/action.yml index 56ab98d..dcfe863 100644 --- a/action.yml +++ b/action.yml @@ -2,7 +2,7 @@ name: "Backporting GitHub Action" description: "GitHub action providing an automated way to backport pull requests from one branch to another" inputs: pull-request: - description: "URL of the pull request to backport, e.g., https://github.com/lampajr/backporting/pull/1" + description: "URL of the pull request to backport, e.g., https://github.com/kiegroup/git-backporting/pull/1" required: false target-branch: description: "Branch where the pull request must be backported to" diff --git a/dist/cli/index.js b/dist/cli/index.js index 275eabd..26b95e4 100755 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -145,7 +145,7 @@ class CLIArgsParser extends args_parser_1.default { .version(package_json_1.version) .description(package_json_1.description) .option("-tb, --target-branch ", "branch where changes must be backported to.") - .option("-pr, --pull-request ", "pull request url, e.g., https://github.com/lampajr/backporting/pull/1.") + .option("-pr, --pull-request ", "pull request url, e.g., https://github.com/kiegroup/git-backporting/pull/1.") .option("-d, --dry-run", "if enabled the tool does not create any pull request nor push anything remotely") .option("-a, --auth ", "git service authentication string, e.g., github token.") .option("-gu, --git-user ", "local git user name, default is 'GitHub'.") @@ -342,7 +342,7 @@ class GitCLIService { } /** * Update the provided remote URL by adding the auth token if not empty - * @param remoteURL remote link, e.g., https://github.com/lampajr/backporting-example.git + * @param remoteURL remote link, e.g., https://github.com/kiegroup/git-backporting-example.git */ remoteWithAuth(remoteURL) { if (this.auth && this.gitData.user) { @@ -737,7 +737,7 @@ class OctokitFactory { OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new rest_1.Octokit({ auth: token, - userAgent: "lampajr/backporting", + userAgent: "kiegroup/git-backporting", baseUrl: apiUrl }); } @@ -771,7 +771,7 @@ class GitLabClient { baseURL: this.apiUrl, headers: { Authorization: token ? `Bearer ${token}` : "", - "User-Agent": "lampajr/backporting", + "User-Agent": "kiegroup/git-backporting", }, httpsAgent: new https_1.default.Agent({ rejectUnauthorized @@ -786,7 +786,7 @@ class GitLabClient { return "noreply@gitlab.com"; } // READ - // example: /api/v4/projects/alampare%2Fbackporting-example/merge_requests/1 + // example: /api/v4/projects/%2Fbackporting-example/merge_requests/1 async getPullRequest(namespace, repo, mrNumber) { const projectId = this.getProjectId(namespace, repo); const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`); @@ -876,7 +876,7 @@ class GitLabClient { } /** * Extract repository namespace, project and mr number from the merge request url - * example: /alampare/backporting-example/-/merge_requests/1 + * example: //backporting-example/-/merge_requests/1 * note: "-/" could be omitted * @param mrUrl merge request url * @returns {{owner: string, project: string}} @@ -23331,7 +23331,7 @@ module.exports = axios; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@lampajr/bper","version":"3.1.1","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/lampajr/backporting.git"},"keywords":["backporting","pull-requests","github-action","cherry-pick"],"bugs":{"url":"https://github.com/lampajr/backporting/issues"},"homepage":"https://github.com/lampajr/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"}}'); /***/ }), diff --git a/dist/gha/index.js b/dist/gha/index.js index dfe5967..dd6ce0d 100755 --- a/dist/gha/index.js +++ b/dist/gha/index.js @@ -331,7 +331,7 @@ class GitCLIService { } /** * Update the provided remote URL by adding the auth token if not empty - * @param remoteURL remote link, e.g., https://github.com/lampajr/backporting-example.git + * @param remoteURL remote link, e.g., https://github.com/kiegroup/git-backporting-example.git */ remoteWithAuth(remoteURL) { if (this.auth && this.gitData.user) { @@ -726,7 +726,7 @@ class OctokitFactory { OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new rest_1.Octokit({ auth: token, - userAgent: "lampajr/backporting", + userAgent: "kiegroup/git-backporting", baseUrl: apiUrl }); } @@ -760,7 +760,7 @@ class GitLabClient { baseURL: this.apiUrl, headers: { Authorization: token ? `Bearer ${token}` : "", - "User-Agent": "lampajr/backporting", + "User-Agent": "kiegroup/git-backporting", }, httpsAgent: new https_1.default.Agent({ rejectUnauthorized @@ -775,7 +775,7 @@ class GitLabClient { return "noreply@gitlab.com"; } // READ - // example: /api/v4/projects/alampare%2Fbackporting-example/merge_requests/1 + // example: /api/v4/projects/%2Fbackporting-example/merge_requests/1 async getPullRequest(namespace, repo, mrNumber) { const projectId = this.getProjectId(namespace, repo); const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`); @@ -865,7 +865,7 @@ class GitLabClient { } /** * Extract repository namespace, project and mr number from the merge request url - * example: /alampare/backporting-example/-/merge_requests/1 + * example: //backporting-example/-/merge_requests/1 * note: "-/" could be omitted * @param mrUrl merge request url * @returns {{owner: string, project: string}} diff --git a/package-lock.json b/package-lock.json index 671b5a1..aef4198 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@lampajr/bper", - "version": "3.1.1", + "name": "@kie/git-backporting", + "version": "4.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@lampajr/bper", - "version": "3.1.1", + "name": "@kie/git-backporting", + "version": "4.0.0", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", @@ -18,7 +18,7 @@ "simple-git": "^3.15.1" }, "bin": { - "bper": "dist/cli/index.js" + "git-backporting": "dist/cli/index.js" }, "devDependencies": { "@commitlint/cli": "^17.4.0", diff --git a/package.json b/package.json index b138bc1..db83dab 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { - "name": "@lampajr/bper", - "version": "3.1.1", - "description": "BPer is a tool to execute automatic git backporting.", + "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": { - "bper": "./dist/cli/index.js" + "git-backporting": "./dist/cli/index.js" }, "files": [ "dist/cli/index.js" @@ -33,18 +33,19 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/lampajr/backporting.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/lampajr/backporting/issues" + "url": "https://github.com/kiegroup/git-backporting/issues" }, - "homepage": "https://github.com/lampajr/backporting#readme", + "homepage": "https://github.com/kiegroup/git-backporting#readme", "devDependencies": { "@commitlint/cli": "^17.4.0", "@commitlint/config-conventional": "^17.4.0", diff --git a/src/service/args/cli/cli-args-parser.ts b/src/service/args/cli/cli-args-parser.ts index 1e90cd8..fe42b9b 100644 --- a/src/service/args/cli/cli-args-parser.ts +++ b/src/service/args/cli/cli-args-parser.ts @@ -17,7 +17,7 @@ export default class CLIArgsParser extends ArgsParser { .version(version) .description(description) .option("-tb, --target-branch ", "branch where changes must be backported to.") - .option("-pr, --pull-request ", "pull request url, e.g., https://github.com/lampajr/backporting/pull/1.") + .option("-pr, --pull-request ", "pull request url, e.g., https://github.com/kiegroup/git-backporting/pull/1.") .option("-d, --dry-run", "if enabled the tool does not create any pull request nor push anything remotely") .option("-a, --auth ", "git service authentication string, e.g., github token.") .option("-gu, --git-user ", "local git user name, default is 'GitHub'.") diff --git a/src/service/git/git-cli.ts b/src/service/git/git-cli.ts index 0061fd5..9e639df 100644 --- a/src/service/git/git-cli.ts +++ b/src/service/git/git-cli.ts @@ -32,7 +32,7 @@ export default class GitCLIService { /** * Update the provided remote URL by adding the auth token if not empty - * @param remoteURL remote link, e.g., https://github.com/lampajr/backporting-example.git + * @param remoteURL remote link, e.g., https://github.com/kiegroup/git-backporting-example.git */ private remoteWithAuth(remoteURL: string): string { if (this.auth && this.gitData.user) { diff --git a/src/service/git/github/octokit-factory.ts b/src/service/git/github/octokit-factory.ts index cad08d9..e63f486 100644 --- a/src/service/git/github/octokit-factory.ts +++ b/src/service/git/github/octokit-factory.ts @@ -15,7 +15,7 @@ export default class OctokitFactory { OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new Octokit({ auth: token, - userAgent: "lampajr/backporting", + userAgent: "kiegroup/git-backporting", baseUrl: apiUrl }); } diff --git a/src/service/git/gitlab/gitlab-client.ts b/src/service/git/gitlab/gitlab-client.ts index 5a76da6..8b7069d 100644 --- a/src/service/git/gitlab/gitlab-client.ts +++ b/src/service/git/gitlab/gitlab-client.ts @@ -21,7 +21,7 @@ export default class GitLabClient implements GitClient { baseURL: this.apiUrl, headers: { Authorization: token ? `Bearer ${token}` : "", - "User-Agent": "lampajr/backporting", + "User-Agent": "kiegroup/git-backporting", }, httpsAgent: new https.Agent({ rejectUnauthorized @@ -40,7 +40,7 @@ export default class GitLabClient implements GitClient { // READ - // example: /api/v4/projects/alampare%2Fbackporting-example/merge_requests/1 + // example: /api/v4/projects/%2Fbackporting-example/merge_requests/1 async getPullRequest(namespace: string, repo: string, mrNumber: number): Promise { const projectId = this.getProjectId(namespace, repo); const { data } = await this.client.get(`/projects/${projectId}/merge_requests/${mrNumber}`); @@ -144,7 +144,7 @@ export default class GitLabClient implements GitClient { /** * Extract repository namespace, project and mr number from the merge request url - * example: /alampare/backporting-example/-/merge_requests/1 + * example: //backporting-example/-/merge_requests/1 * note: "-/" could be omitted * @param mrUrl merge request url * @returns {{owner: string, project: string}}