Skip to content

Commit d751e6e

Browse files
committed
Add backport support
1 parent e9172df commit d751e6e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/backport.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# WARNING:
2+
# When extending this action, be aware that $GITHUB_TOKEN allows write access to
3+
# the GitHub repository. This means that it should not evaluate user input in a
4+
# way that allows code injection.
5+
6+
name: Backport
7+
8+
on:
9+
pull_request_target:
10+
types: [closed, labeled]
11+
12+
permissions: {}
13+
14+
jobs:
15+
backport:
16+
name: Backport Pull Request
17+
if: github.repository_owner == 'jumpstarter-dev' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
18+
runs-on: ubuntu-24.04
19+
steps:
20+
# Use a GitHub App to create the PR so that CI gets triggered
21+
# The App is scoped to Repository > Contents and Pull Requests: write for jumpstarter-dev
22+
- uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
23+
id: app-token
24+
with:
25+
app-id: ${{ secrets.JUMPSTARTER_BACKPORT_BOT_APP_ID }}
26+
private-key: ${{ secrets.JUMPSTARTER_BACKPORT_BOT_PRIVATE_KEY }}
27+
28+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
ref: ${{ github.event.pull_request.head.sha }}
31+
token: ${{ steps.app-token.outputs.token }}
32+
33+
- name: Create backport PRs
34+
uses: korthout/backport-action@436145e922f9561fc5ea157ff406f21af2d6b363 # v3.2.0
35+
with:
36+
# Config README: https://github.com/korthout/backport-action#backport-action
37+
github_token: ${{ steps.app-token.outputs.token }}
38+
conflict_resolution: draft_commit_conflicts
39+
merge_commits: skip
40+
pull_description: |-
41+
Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
42+

0 commit comments

Comments
 (0)