pull-request icon indicating copy to clipboard operation
pull-request copied to clipboard

steps.open-pr.outputs.pr_number is branch name instead of PR number

Open tt-gh-bot opened this issue 3 years ago • 0 comments

I'm trying to access PR number from output. but as it seems it's source_branch instead of pr number.

here is my github workflow steps

      - name: Create New Branch
        shell: bash
        run: |
          SOURCE_BRANCH=auto-merge-${GITHUB_REF#refs/heads/release-}-${RUN_NUMBER}
          git checkout -b ${SOURCE_BRANCH} 
          echo "SOURCE_BRANCH=${SOURCE_BRANCH}" >> $GITHUB_ENV
      - name: create pull request
        id: open-pr
        uses: QRjet/pull-request@v2t
        with:
          github_token: ${{ secrets.GH_BOT_PERSONAL_ACCESS_TOKEN }}
          source_branch: ${{ env.SOURCE_BRANCH }}
          destination_branch: ${{ env.DESTINATION_BRANCH }}
          pr_title: '[Automated] Merge ${{ github.ref_name }} with fork ${{ env.SOURCE_BRANCH }} into ${{ env.DESTINATION_BRANCH }}, RUN_NUMBER: ${{ github.run_number }}'
          pr_body: 'Automated Pull Request'
          pr_label: 'automerge'
          pr_assignee: ${{ env.GIT_COMMIT_AUTHOR_NAME }}
      - name: enable automerge
        if: steps.open-pr.outputs.pr_number != ''
        uses: 'QRjet/[email protected]'
        env:
          GITHUB_TOKEN: '${{ secrets.GH_BOT_PERSONAL_ACCESS_TOKEN }}'
          PULL_REQUEST: ${{ steps.open-pr.outputs.pr_number }}
          MERGE_METHOD: 'merge'
          MERGE_REQUIRED_APPROVALS: 0

actually I create a brand new branch from current branch and then use that as source branch. I also made some changes to the action so that it also include --publish flag to the github pull-request

https://github.com/QRjet/pull-request/blob/master/entrypoint.sh#L85

this is the result of PR_URL https://github.com/repo-sync/pull-request/blob/master/entrypoint.sh#L96

remote:      https://github.com/QRjet/truetale/pull/new/auto-merge-24-36

and after this line https://github.com/repo-sync/pull-request/blob/master/entrypoint.sh#L98 it becomes this auto-merge-24-36

so basically pr_number=auto-merge-24-36

tt-gh-bot avatar Jul 16 '22 10:07 tt-gh-bot