diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 6559b3b15b..c792ee9434 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -42,9 +42,11 @@ jobs: - name: Label new backport PR with backport-automerge label run: | - PR_BRANCH=backport/backport-<%= number %>-to-<%= base %> + PR_BRANCH=`echo ${{ github.event.label.name }}` + PR_BRANCH=`echo $PR_BRANCH | cut -d ' ' -f2` + PR_BRANCH=backport/backport-${{ github.event.pull_request.number }}-to-$PR_BRANCH PR_NUMBER=`gh pr list -R opensearch-project/documentation-website --json "number,headRefName" --state open | jq -r ".[] | select(.headRefName == \"$PR_BRANCH\") | .number"` - echo "Update Backport PR #$PR_NUMBER on branch $PR_BRANCH with backport-automerge label" + echo "Update Backport PR '#$PR_NUMBER' on branch '$PR_BRANCH' with 'backport-automerge' label" gh issue edit -R opensearch-project/documentation-website $PR_NUMBER --add-label backport-automerge env: - GH_TOKEN: ${{ steps.github_app_token.outputs.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}