Skip to content

Commit

Permalink
feat: integrate tool with gitlab service (#39)
Browse files Browse the repository at this point in the history
* feat: integrate tool with gitlab service

Fix #30
  • Loading branch information
lampajr committed Jul 1, 2023
1 parent 8a00794 commit 107f5e5
Show file tree
Hide file tree
Showing 35 changed files with 35,121 additions and 18,853 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ test/**/_temp/**/*
yarn.lock
coverage/
test-report.xml
report.json
.idea/
.vscode/
build/
# dist/
# dist/
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@

---

**BPer** is a [NodeJS](https://nodejs.org/) command line tool that provides capabilities to *backport* [1] pull requests 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 Backporter**, also referenced as **bper**, is a [NodeJS](https://nodejs.org/) command line tool that provides capabilities to *backport* [1] 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.

[1] *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.

Table of content
----------------

* **[Usage](#usage)**
* **[Supported Git Services](#supported-git-services)**
* **[GitHub Action](#github-action)**
* **[Limitations](#limitations)**
* **[Contributions](#contributing)**
* **[License](#license)**


## Usage

This tool is released on the [public npm registry](https://www.npmjs.com/), therefore it can be easily installed using `npm`:
Expand All @@ -40,7 +40,7 @@ $ npm install -g @lampajr/bper
Then it can be used as any other command line tool:

```bash
$ bper -tb <branch> -pr <pull-request-url> -a <github-token> [-f <your-folder>]
$ bper -tb <branch> -pr <pull-request-url> -a <git-token> [-f <your-folder>]
```

### Inputs
Expand All @@ -66,10 +66,18 @@ This toold comes with some inputs that allow users to override the default behav
| Backport Branch Name | --bp-branch-name | N | Name of the backporting pull request branch | bp-{target-branch}-{sha} |
| Dry Run | -d, --dry-run | N | If enabled the tool does not push nor create anything remotely, use this to skip PR creation | false |

## Supported Git Services

Right now **bper** 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.

> **NOTE**: by default, all gitlab requests are performed setting `rejectUnauthorized=false`, planning to make this configurable too.
## GitHub Action

This action can be used in any GitHub workflow, below you can find a simple example of manually triggered workflow backporting a specific pull request (provided as input).
This action can be used in any *GitHub* workflow, below you can find a simple example of manually triggered workflow backporting a specific pull request (provided as input).

```yml
name: Pull Request Backporting using BPer
Expand Down Expand Up @@ -145,25 +153,20 @@ jobs:

For a complete description of all inputs see [Inputs section](#inputs).

## Limitations

**BPer** is in development mode, this means that it has many limitations right now. I'll try to summarize the most importan ones:
## Future Works

- You can backport pull requests only.
- It only works for [GitHub](https://github.com/).
- Integrated in GitHub Actions CI/CD only.
**BPer** is still in development mode, this means that there are still many future works and extension. I'll try to summarize the most important ones:

Based on these limitations, the next **Future Works** could be the following:
- Provide a way to backport single commit too (or a set of them), even if no original pull request is present.
- Integrate this tool with other git management services (like GitLab and Bitbucket) to make it as generic as possible.
- Integrate it into other CI/CD services like gitlab CI (once GitLab will be integrated as well).
- Provide some reusable GitHub workflows.
- Integrate this tool with other git management services (like Bitbucket) to make it as generic as possible.
- Integrate it into other CI/CD services like gitlab CI.
- Provide some reusable *GitHub* workflows.

## Contributing

This is an open source project, and you are more than welcome to contribute :heart:!

Every change must be submitted through a GitHub pull request (PR). Backporting uses continuous integration (CI). The CI runs checks against your branch after you submit the PR to ensure that your PR doesn’t introduce errors. If the CI identifies a potential problem, our friendly PR maintainers will help you resolve it.
Every change must be submitted through a *GitHub* pull request (PR). Backporting uses continuous integration (CI). The CI runs checks against your branch after you submit the PR to ensure that your PR doesn’t introduce errors. If the CI identifies a potential problem, our friendly PR maintainers will help you resolve it.

> **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.
Expand Down

0 comments on commit 107f5e5

Please sign in to comment.