Skip to content

Commit ca15af6

Browse files
nbdd0121jwnrt
authored andcommitted
[ci] automatic cherry-picking of branches
Signed-off-by: Gary Guo <[email protected]>
1 parent 74c1b11 commit ca15af6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/cherrypick.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright lowRISC contributors.
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Cherry-pick Pull Request
6+
on:
7+
pull_request_target:
8+
types: [closed, labeled]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
cherrypick:
15+
# NOTE: We currently need these permissions because we create pull request with the repo-scoped
16+
# default token. We should in the future move to a PAT owned by lowrisc-bot and create pull request
17+
# on its behalf.
18+
permissions:
19+
# Needed for the action to create branch.
20+
contents: write
21+
# Needed for the action to create a pull request.
22+
pull-requests: write
23+
24+
name: Cherry-pick Pull Request
25+
if: github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('CherryPick:', github.event.label.name))
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ github.event.pull_request.head.sha }}
31+
32+
- name: Create backport PRs
33+
uses: korthout/backport-action@e8161d6a0dbfa2651b7daa76cbb75bc7c925bbf3 # v2.4.1
34+
with:
35+
label_pattern: "^CherryPick:([^ ]+)$"
36+
pull_title: "Cherry-pick to ${target_branch}: ${pull_title}"
37+
pull_description: |
38+
This is an automatic cherry-pick of #${pull_number} to branch `${target_branch}`.

0 commit comments

Comments
 (0)