From 48b43cf55285f00c8ef0b03e2a74db1b6bff0bba Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:12:55 +0200 Subject: [PATCH 1/2] ci: automatically cherry-pick changes from release/candidate (#1894) (#1895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: (cherry picked from commit 61695e3c4a9bfe394e2d1a219b4595740e62d9f6) Co-authored-by: Vitor Hugo Schwaab --- .../workflows/cherry-pick-rc-to-develop.yml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/cherry-pick-rc-to-develop.yml diff --git a/.github/workflows/cherry-pick-rc-to-develop.yml b/.github/workflows/cherry-pick-rc-to-develop.yml new file mode 100644 index 00000000000..6ceccf09a49 --- /dev/null +++ b/.github/workflows/cherry-pick-rc-to-develop.yml @@ -0,0 +1,50 @@ +name: "Cherry-pick from rc to develop" + +on: + pull_request: + branches: + - release/candidate + types: + - closed + +jobs: + cherry-pick: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Append -cherry-pick to branch name + id: extract + run: | + PR_BRANCH="${{ github.event.pull_request.head.ref }}" + NEW_BRANCH_NAME="${PR_BRANCH}-cherry-pick" + echo "New branch name: $NEW_BRANCH_NAME" + echo "::set-output name=newBranchName::$NEW_BRANCH_NAME" + + - uses: fregante/setup-git-user@v2 + + - name: Cherry-pick commits + run: | + git fetch origin develop:develop + git checkout -b ${{ steps.extract.outputs.newBranchName }} develop + # Cherry-picking the last commit on the base branch + git cherry-pick -x ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true + git add . + git cherry-pick --continue || true + git push origin ${{ steps.extract.outputs.newBranchName }} + + - name: Create PR + env: + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BRANCH: ${{ steps.extract.outputs.newBranchName }} + PR_ASSIGNEE: ${{ github.event.pull_request.user.login }} + PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n ---- \n{1}', github.event.pull_request.number, github.event.pull_request.body) }}" + run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base develop --head $PR_BRANCH --label "cherry-pick" --assignee "$PR_ASSIGNEE" From 862961480638b9709d8add442a097b2f13683cdc Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Tue, 18 Jul 2023 17:16:55 +0200 Subject: [PATCH 2/2] ci: remove -x argument from cherry-pick The commit message already holds reference to the original PR, and this gets in the way of giving credit to all the people involved by breaking the `Co-Authored By` block. --- .github/workflows/cherry-pick-rc-to-develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherry-pick-rc-to-develop.yml b/.github/workflows/cherry-pick-rc-to-develop.yml index 6ceccf09a49..7755fff6f51 100644 --- a/.github/workflows/cherry-pick-rc-to-develop.yml +++ b/.github/workflows/cherry-pick-rc-to-develop.yml @@ -36,7 +36,7 @@ jobs: git fetch origin develop:develop git checkout -b ${{ steps.extract.outputs.newBranchName }} develop # Cherry-picking the last commit on the base branch - git cherry-pick -x ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true + git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true git add . git cherry-pick --continue || true git push origin ${{ steps.extract.outputs.newBranchName }}