forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d7f443
commit 6c3c5db
Showing
1 changed file
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Dynamic Backport PR | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branch: [master] | ||
|
||
jobs: | ||
backport: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract Target Branch from Label | ||
id: extract_branch | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const labels = context.payload.pull_request.labels; | ||
const backportLabel = labels.find(label => label.name.startsWith('backport/')); | ||
if (!backportLabel) throw new Error('No backport label found'); | ||
const targetBranch = backportLabel.name.replace('backport/', 'next-'); | ||
return targetBranch; | ||
result-encoding: 'string' | ||
|
||
- name: Log Target Branch | ||
run: echo "The target branch is ${{ steps.extract_branch.outputs.result }}" | ||
|
||
- name: Backport to Target Branch | ||
if: steps.extract_branch.outputs.result | ||
uses: tibdex/backport@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
backport_to: ${{ steps.extract_branch.outputs.result }} | ||
|