From a894e6404f46e399815e2260b1684dba9ea31b61 Mon Sep 17 00:00:00 2001 From: Andrea Lamparelli Date: Thu, 22 Dec 2022 16:52:32 +0100 Subject: [PATCH] first README draft --- .github/workflows/ci.yml | 27 +++++++++++ .github/workflows/publish-gha.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/pull-request.yml | 5 +- README.md | 73 ++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..68ea58d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: CI Checks + +on: + push: + branches: + - main + +jobs: + build: + strategy: + matrix: + node-version: [16] + os: [ubuntu-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run test:report \ No newline at end of file diff --git a/.github/workflows/publish-gha.yml b/.github/workflows/publish-gha.yml index 2eeaeae..e88b1d3 100644 --- a/.github/workflows/publish-gha.yml +++ b/.github/workflows/publish-gha.yml @@ -1,7 +1,7 @@ ## # Publish new action tag(s) for downstream consumption ## -name: Publish +name: Publish GitHub Action # Manual or automatic release on: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 18723db..542be1f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish +name: Publish NPM Package on: workflow_dispatch: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4d482ef..98ec53d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,9 +15,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - run: npm ci \ No newline at end of file + - run: npm ci + - run: npm test \ No newline at end of file diff --git a/README.md b/README.md index e69de29..6ce687b 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,73 @@ +

BPER: Git Backporter

+

:outbox_tray: :inbox_tray:

+ +

+ + GitHub Actions status + +

+ +--- + +**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. + +[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)** +* **[GitHub Action](#github-action)** +* **[Limitations](#limitations)** +* **[Contributions](#contributions)** + + +## Usage + +### Inputs + +## 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). + +```yml +name: Pull Request Backporting using BPer + +on: + workflow_dispatch: + inputs: + targetBranch: + description: 'Target branch' + required: true + type: string + pullRequest: + description: 'Pull request' + required: true + type: string + dryRun: + description: 'Dry run' + required: false + default: "true" + type: string + +jobs: + backporting: + name: "Backporting" + runs-on: ubuntu-latest + steps: + - name: Backporting + uses: lampajr/backporting@main + with: + target-branch: ${{ inputs.targetBranch }} + pull-request: ${{ inputs.pullRequest }} + auth: ${{ secrets.GITHUB_TOKEN }} + dry-run: ${{ inputs.dryRun }} +``` + +You can also use this action with other events - you'll just need to specify `target-branch` and `pull-request` params. + +For a complete description of all inputs see [Inputs section](#inputs). + +## Limitations + +## Contributions \ No newline at end of file