-
Notifications
You must be signed in to change notification settings - Fork 2.1k
59 lines (58 loc) · 2.41 KB
/
bot-cherry-pick.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Github Rebot for Cherry Pick On Comment
on:
issue_comment:
types: [created]
jobs:
cherry-pick:
name: Cherry Pick
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick') && github.event.comment.user.login=='sealos-ci-robot'
runs-on: ubuntu-latest
steps:
- name: Write vars
id: set-target
run: |
TARGET_BRANCH=$(jq -r ".comment.body" "$GITHUB_EVENT_PATH" | awk '{ print $2 }' | tr -d '[:space:]')
echo "🤖 says: ‼️ TARGET_BRANCH is $TARGET_BRANCH"
echo "target=$TARGET_BRANCH" >> $GITHUB_OUTPUT
if [ -z "$PR_NUMBER" ]; then
PR_NUMBER=$(jq -r ".pull_request.number" "$GITHUB_EVENT_PATH")
if [[ "$PR_NUMBER" == "null" ]]; then
PR_NUMBER=$(jq -r ".issue.number" "$GITHUB_EVENT_PATH")
fi
if [[ "$PR_NUMBER" == "null" ]]; then
echo "Failed to determine PR Number."
exit 1
fi
fi
echo "prNumber=$PR_NUMBER" >> $GITHUB_OUTPUT
- name: Checkout the latest code
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
fetch-depth: 0
- name: Automatic Cherry Pick
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
git config --global --add safe.directory /github/workspace
git config --global user.email "sealos-ci-robot"
git config --global user.name "sealos-ci-robot@sealos.io"
bash ./scripts/cherry-pick.sh
- uses: peter-evans/create-pull-request@v5
with:
title: 'docs: Automated CherryPick Update for ${{ steps.set-target.outputs.target }} '
body: |
copilot:all
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: |
🤖 cherry-pick to ${{ steps.set-target.outputs.target }} using robot.
branch: cherry-pick-${{ steps.set-target.outputs.target }}-${{ steps.set-target.outputs.prNumber }}
base: ${{ steps.set-target.outputs.target }}
signoff: true
delete-branch: true
token: ${{ secrets.GH_PAT }}
reviewers: cuisongliu
milestone: cherry-pick
committer: sealos-ci-robot <sealos-ci-robot@sealos.io>
author: sealos-ci-robot <sealos-ci-robot@sealos.io>