Backport a commit #24
This file contains 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: Backport a commit | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Destination branch (ex: bflat-release/7.0)' | |
required: true | |
commit: | |
description: 'Commit hash' | |
required: true | |
jobs: | |
backport: | |
if: ${{ github.actor == 'MichalStrehovsky' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
ref: '${{ github.event.inputs.branch }}' | |
fetch-depth: 0 | |
- name: Configure git | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
- name: Create branch | |
run: git checkout -b backport-${{ github.event.inputs.branch }}-${{ github.event.inputs.commit }} | |
- name: Cherry pick commit | |
run: git cherry-pick ${{ github.event.inputs.commit }} | |
- name: Push | |
run: git push --force --set-upstream origin HEAD:backport-${{ github.event.inputs.branch }}-${{ github.event.inputs.commit }} | |
- name: Create pull request | |
uses: ./bflat/actions/pullrequest | |
with: | |
auth_token: ${{ secrets.GITHUB_TOKEN }} | |
source_branch: backport-${{ github.event.inputs.branch }}-${{ github.event.inputs.commit }} | |
target_branch: ${{ github.event.inputs.branch }} | |
pr_title: '[${{ github.event.inputs.branch }}] Backport of ${{ github.event.inputs.commit }}' | |