create-cherrypick-pr #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |