Skip to content

Rebase #3867

Rebase #3867 #2384

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@v2
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>