v2.13.0 #65
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
name: Automatic Backport | |
on: | |
pull_request: | |
types: ["closed", "labeled"] | |
jobs: | |
backport: | |
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'backport-to-main') == true) }} | |
name: Backport PR | |
runs-on: ubuntu-latest | |
steps: | |
# Get the merge target branch to decide mainline number | |
# git cherry-pick mainline is 1 for merge to 'dev', else 2 | |
- name: Get target branch | |
run: echo "CP_MAINLINE=$(if [ '${{ github.event.pull_request.base.ref }}' == 'dev' ]; then echo 1; else echo 2; fi)" >> $GITHUB_ENV | |
- name: Write json | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: ".backportrc.json" | |
json: | | |
{ | |
"targetPRLabels": ["backport"], | |
"mainline": ${{ env.CP_MAINLINE }}, | |
"commitConflicts": "true", | |
"prTitle": "[{{sourceBranch}} to {{targetBranch}}] backport: {{sourcePullRequest.title}} ({{sourcePullRequest.number}})" | |
} | |
- name: Backport Action | |
uses: sorenlouv/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
auto_backport_label_prefix: backport-to- | |
- name: Info log | |
if: ${{ success() }} | |
run: cat ~/.backport/backport.info.log | |
- name: Debug log | |
if: ${{ failure() }} | |
run: cat ~/.backport/backport.debug.log | |