-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: gha skip whitespace trim on body (#73)
this also added a github workflow example
- Loading branch information
Showing
4 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"pull_request": { | ||
"url": "https://api.github.com/repos/lampajr/backporting-example/pulls/66", | ||
"html_url": "https://github.com/lampajr/backporting-example/pull/66", | ||
"diff_url": "https://github.com/lampajr/backporting-example/pull/66.diff", | ||
"patch_url": "https://github.com/lampajr/backporting-example/pull/66.patch", | ||
"issue_url": "https://api.github.com/repos/lampajr/backporting-example/issues/66", | ||
"number": 66, | ||
"state": "closed", | ||
"title": "Feature1: multiple changes", | ||
"user": { | ||
"login": "lampajr" | ||
}, | ||
"body": "This is the body of multiple change", | ||
"merge_commit_sha": "0bcaa01cdd509ca434e123d2e2b9ce7f66234bd7", | ||
"assignee": null, | ||
"assignees": [ | ||
|
||
], | ||
"requested_reviewers": [ | ||
|
||
], | ||
"requested_teams": [ | ||
|
||
], | ||
"labels": [ | ||
{ | ||
"name": "backport-develop", | ||
"color": "AB975B", | ||
"default": false, | ||
"description": "" | ||
} | ||
], | ||
"head": { | ||
"label": "lampajr:feature1", | ||
"ref": "feature1", | ||
"sha": "69e49388ea2ca9be272b188a9271806d487bf01e", | ||
"user": { | ||
"login": "lampajr" | ||
}, | ||
"repo": { | ||
"name": "backporting-example", | ||
"full_name": "lampajr/backporting-example", | ||
"owner": { | ||
"login": "lampajr" | ||
}, | ||
"html_url": "https://github.com/lampajr/backporting-example", | ||
"clone_url": "https://github.com/lampajr/backporting-example.git" | ||
} | ||
}, | ||
"base": { | ||
"label": "lampajr:main", | ||
"ref": "main", | ||
"sha": "c85b8fcdb741814b3e90e6e5729455cf46ff26ea", | ||
"user": { | ||
"login": "lampajr" | ||
}, | ||
"repo": { | ||
"name": "backporting-example", | ||
"full_name": "lampajr/backporting-example", | ||
"owner": { | ||
"login": "lampajr" | ||
}, | ||
"html_url": "https://github.com/lampajr/backporting-example", | ||
"description": "Playground repository for automated backporting testing", | ||
"url": "https://api.github.com/repos/lampajr/backporting-example", | ||
"issues_url": "https://api.github.com/repos/lampajr/backporting-example/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/lampajr/backporting-example/pulls{/number}", | ||
"clone_url": "https://github.com/lampajr/backporting-example.git" | ||
} | ||
}, | ||
"merged": true, | ||
"merged_by": { | ||
"login": "lampajr" | ||
}, | ||
"comments": 0, | ||
"commits": 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters