mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-06-28 05:33:47 +00:00
fix: gha skip whitespace trim on body (#73)
this also added a github workflow example
This commit is contained in:
parent
fa43ffc1dc
commit
29589a63b5
4 changed files with 136 additions and 4 deletions
53
examples/on-pr-merge/automated-workflow.yaml
Normal file
53
examples/on-pr-merge/automated-workflow.yaml
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: Automated Backporting on PR merge using Git Backporting
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [closed, labeled]
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
compute-targets:
|
||||
if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
target-branches: ${{ steps.set-targets.outputs.targets }}
|
||||
env:
|
||||
LABELS: ${{ toJSON(github.event.pull_request.labels) }}
|
||||
steps:
|
||||
- name: Set target branches
|
||||
id: set-targets
|
||||
uses: kiegroup/kie-ci/.ci/actions/parse-labels@main
|
||||
with:
|
||||
labels: ${LABELS}
|
||||
|
||||
backporting:
|
||||
if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged && needs.compute-targets.outputs.target-branches != '[]' }}
|
||||
name: "[${{ matrix.target-branch }}] - Backporting"
|
||||
runs-on: ubuntu-latest
|
||||
needs: compute-targets
|
||||
strategy:
|
||||
matrix:
|
||||
target-branch: ${{ fromJSON(needs.compute-targets.outputs.target-branches) }}
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Backporting
|
||||
uses: ./
|
||||
with:
|
||||
dry-run: true
|
||||
pull-request: ${{ github.event.pull_request.html_url }}
|
||||
target-branch: ${{ matrix.target-branch }}
|
||||
auth: "${{ env.GITHUB_TOKEN }}"
|
||||
title: "[${{ matrix.target-branch }}] ${{ github.event.pull_request.title }}"
|
||||
body-prefix: "**Backport:** ${{ github.event.pull_request.html_url }}\r\n\r\n**Note**: comment 'ok to test' to properly launch Jenkins jobs\r\n\r\n"
|
||||
body: "${{ github.event.pull_request.body }}"
|
||||
labels: "cherry-pick :cherries:"
|
||||
inherit-labels: false
|
||||
bp-branch-name: "${{ matrix.target-branch }}_${{ github.event.pull_request.head.ref }}"
|
Loading…
Add table
Add a link
Reference in a new issue