diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 126a25d7..06ec8dbe 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -1,29 +1,36 @@ -name: Cherry pick PR into release-1.0 branch +name: Cherry-Pick into release-1.0 branch on: - pull_request_target: + pull_request: + types: [closed] branches: - main jobs: - cherry_pick_release_1_0: + cherry_pick: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'cherry-pick-release-1.0') runs-on: ubuntu-latest - name: Cherry pick into release-1.0 branch - if: ${{ contains(github.event.pull_request.labels.*.name, 'cherry-pick-release-1.0') && github.event.pull_request.merged == true }} steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cherry pick into release-1.0 branch - uses: carloscastrojumo/github-cherry-pick-action@v1.0.10 + + - name: Set up Git + run: | + git config user.name "GitHub Actions Bot" + git config user.email "actions@github.com" + + - name: Cherry-pick commit + run: | + git checkout release-1.0 + git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 with: - branch: release-1.0 - labels: | - cherry-pick - reviewers: | - instructlab/ui-maintainers - title: '[cherry-pick] {old_title}' - body: 'Cherry picking #{old_pull_request_id} onto this branch' -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} + branch: cherry-pick-${{ github.event.pull_request.number }} + base: release-1.0 + title: 'Cherry-pick: Add commit to release-1.0 ${{ github.event.pull_request.title }}' + body: 'Automatically cherry-picked commit from main branch'