diff --git a/.github/actions/backport/action.yml b/.github/actions/backport/action.yml index 38373f89..9ddd866f 100644 --- a/.github/actions/backport/action.yml +++ b/.github/actions/backport/action.yml @@ -36,12 +36,6 @@ runs: else echo "No backport detected." fi - - - name: Checkout base branch - if : ${{ env.BACKPORT == 'true' }} - uses: actions/checkout@v4 - with: - ref: ${{ inputs.base_branch }} - name: Backport changes if: ${{ env.BACKPORT == 'true' }} @@ -52,6 +46,14 @@ runs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" + git fetch --all + + BASE_BRANCH="${{ inputs.base_branch }}" + BACKPORT_BRANCH="backport-${{ env.PR_NUMBER }}-to-${{ inputs.base_branch }}" + git checkout $BASE_BRANCH + git pull origin $BASE_BRANCH + git checkout -b $BACKPORT_BRANCH + BACKPORT_BRANCH="backport-${{ env.PR_NUMBER }}-to-${{ inputs.base_branch }}" git checkout -b $BACKPORT_BRANCH