Skip to content

create-cherrypick-pr #12

create-cherrypick-pr

create-cherrypick-pr #12

name: create-cherrypick-pr
on:
workflow_dispatch:
inputs:
sourceCommit:
description: 'Source commit to cherry-pick from'
required: true
type: string
targetBranch:
description: 'Target branch to create PR against'
required: true
type: string
targetCommit:
description: 'Target commit/reference to base the PR on'
required: true
type: string
charts:
description: 'Comma-separated list of charts to include'
required: true
type: string
memorableName:
description: 'A easy-to-remember name to recognize the PR by'
required: true
type: string
jobs:
pick:
runs-on: ubuntu-24.04
steps:
- name: test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_COMMIT: ${{ inputs.sourceCommit }}
TARGET_BRANCH: ${{ inputs.targetBranch }}
TARGET_COMMIT: ${{ inputs.targetCommit }}
CHARTS: ${{ inputs.charts }}
MEMORABLE_NAME: ${{ inputs.memorableName }}
shell: bash
run: |
set -e
git config --global --add safe.directory "$PWD"
git clone https://x-access-token:"${GITHUB_TOKEN}"@github.com/${{ github.repository }} .
PR_BRANCH="cherry-pick-${TARGET_BRANCH}-$(date '+%Y%m%d%H%M%S')"
echo "PR branch: $PR_BRANCH"
git reset --hard "$TARGET_COMMIT"
git checkout -b "$PR_BRANCH"