Skip to content

Commit f7d992b

Browse files
authored
Use korthout Backport action (#251)
It seems to be currently maintained
1 parent 023a4c5 commit f7d992b

File tree

1 file changed

+5
-48
lines changed

1 file changed

+5
-48
lines changed

.github/workflows/backport.yml

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,17 @@ on:
66

77
jobs:
88
backport:
9-
if: >
10-
github.event.action == 'labeled' &&
11-
github.event.pull_request.merged == true &&
12-
startsWith(github.event.label.name, 'backport ')
9+
if: github.event.pull_request.merged == true
1310
runs-on: ubuntu-latest
1411

1512
permissions:
1613
contents: write
1714
pull-requests: write
1815

1916
steps:
20-
- name: Determine target branch
21-
id: vars
22-
run: |
23-
label="${{ github.event.label.name }}"
24-
target="${label#backport }"
25-
echo "target=$target" >> "$GITHUB_OUTPUT"
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v 6.0.2
2618

27-
- name: Checkout repo
28-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v 6.0.2
19+
- name: Backport
20+
uses: korthout/backport-action@4aaf0e03a94ff0a619c9a511b61aeb42adea5b02 # v4.2.0
2921
with:
30-
fetch-depth: 0
31-
32-
- name: Configure git
33-
run: |
34-
git config user.name "github-actions"
35-
git config user.email "github-actions@github.com"
36-
37-
- name: Cherry pick merge commit
38-
env:
39-
TARGET: ${{ steps.vars.outputs.target }}
40-
PR: ${{ github.event.pull_request.number }}
41-
run: |
42-
MERGE_SHA=${{ github.event.pull_request.merge_commit_sha }}
43-
44-
BRANCH="backport/pr-${PR}-to-${TARGET}"
45-
46-
git fetch origin $TARGET
47-
git checkout -b $BRANCH origin/$TARGET
48-
49-
git cherry-pick -x $MERGE_SHA
50-
51-
git push origin $BRANCH
52-
53-
- name: Create PR
54-
env:
55-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
TARGET: ${{ steps.vars.outputs.target }}
57-
PR: ${{ github.event.pull_request.number }}
58-
run: |
59-
BRANCH="backport/pr-${PR}-to-${TARGET}"
60-
61-
gh pr create \
62-
--base $TARGET \
63-
--head $BRANCH \
64-
--title "Backport PR #$PR to $TARGET" \
65-
--body "Automated backport of #$PR to \`$TARGET\`."
22+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)