Skip to content

Commit

Permalink
[backport] ci: automatically cherry-pick/backport PR (#489) (#491)
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
reaver-flomesh authored Nov 30, 2024
1 parent a2a08b2 commit 5ea26d6
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"color": "EEEEEE"
},
"CHECKS": {
"regexp": "^(\\[WIP\\]|\\[BACKPORT\\]|\\[CHERRY-PICK\\])?( )?(feat|fix|docs|build|test|ci|chore|refactor|perf)!?(\\(.*\\))?!?:.*"
"regexp": "^(\\[wip\\]|\\[backport\\]|\\[cherry-pick\\])?( )?(feat|fix|docs|build|test|ci|chore|refactor|perf)!?(\\(.*\\))?!?:.*",
"regexpFlags": "i",
"ignoreLabels" : ["dont-check-PR-title"]
},
"MESSAGES": {
"success": "PR title is valid",
"failure": "PR title is invalid",
"notice": "PR Title needs to pass regex '^(\\[WIP\\]|\\[BACKPORT\\]|\\[CHERRY-PICK\\])?( )?(feat|fix|docs|build|test|ci|chore|refactor|perf)!?(\\(.*\\))?!?:.*'"
"notice": "PR Title needs to pass case insensitive regex '^(\\[wip\\]|\\[backport\\]|\\[cherry-pick\\])?( )?(feat|fix|docs|build|test|ci|chore|refactor|perf)!?(\\(.*\\))?!?:.*'"
}
}
31 changes: 31 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
branches:
- main
types: ['closed']

env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }}

jobs:
backport_v1_4:
runs-on: ubuntu-latest
name: Backport into release/v1.4
if: ${{ !startsWith(github.event.pull_request.title, '[cherry-pick]') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Backport into release/v1.4
uses: korthout/backport-action@v3
with:
copy_assignees: true
copy_labels_pattern: '*'
copy_requested_reviewers: true
github_token: ${{ secrets.WORKFLOW_PAT }}
pull_title: '[backport] ${pull_title}'
pull_description: 'Backport #${pull_number} to `${target_branch}`.'
target_branches: 'release/v1.4'


31 changes: 31 additions & 0 deletions .github/workflows/cherry-pick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
branches:
- release/v1.4
types: ['closed']

env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }}

jobs:
cherry_pick_main:
runs-on: ubuntu-latest
name: Cherry pick into main
if: ${{ !startsWith(github.event.pull_request.title, '[backport]') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cherry pick into main
uses: korthout/backport-action@v3
with:
copy_assignees: true
copy_labels_pattern: '*'
copy_requested_reviewers: true
github_token: ${{ secrets.WORKFLOW_PAT }}
pull_title: '[cherry-pick] ${pull_title}'
pull_description: 'Cherry picking #${pull_number} to `${target_branch}`.'
target_branches: 'main'


0 comments on commit 5ea26d6

Please sign in to comment.