Skip to content

ci: find a way to reenable the cherry-picker process #1

ci: find a way to reenable the cherry-picker process

ci: find a way to reenable the cherry-picker process #1

Workflow file for this run

name: Cherry pick
on:
pull_request:
branches:
- main
types: ["closed"]
permissions:
contents: read
pull-requests: write
jobs:
cherry_pick_release_v1_1:
runs-on: ubuntu-22.04
name: Cherry pick into release/v1.1
if: ${{ contains(github.event.pull_request.labels.*.name, 'cherrypick/release-v1.1') && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Cherry pick into release/v1.1
run: |
TARGET_BRANCH="release/v1.1"
CHERRY_PICK_BRANCH="cherry-pick-$(date +'%Y%m%d%H%M%S')"
MERGE_COMMIT_SHA=$(git log -1 --pretty=format:%H)
# Fetch and create new branch from target
git fetch origin $TARGET_BRANCH
git checkout -b $CHERRY_PICK_BRANCH origin/$TARGET_BRANCH
# Cherry-pick the commit
git cherry-pick $MERGE_COMMIT_SHA || git cherry-pick --abort
# Push the new branch
git push origin $CHERRY_PICK_BRANCH
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Cherry pick ${MERGE_COMMIT_SHA} into ${TARGET_BRANCH}"
branch: $CHERRY_PICK_BRANCH
title: "[release/v1.1] Cherry pick ${MERGE_COMMIT_SHA}"
body: "Cherry picking commit ${MERGE_COMMIT_SHA} onto ${TARGET_BRANCH}"
base: $TARGET_BRANCH