Skip to content

PR creation fails with a very confusing message #6224

Closed

Description

@pantelis-karamolegkos

Describe the bug

PR creation fails and the message is far from being helpful

Steps to reproduce the behavior

I am running the following steps in a GH Actions workflow

      - name: commit and push to remote
        id: commit-push
        shell: bash
        run: |
          BRANCHNAME=foo-$RANDOM
          cd /tmp/$(basename ${{ matrix.repository }} .git)
          git config user.name ${{ env.GH_USERNAME }}
          git config user.email ${{ env.GH_USERMAIL }}
          git checkout -b $BRANCHNAME
          git add .
          git commit -am "Some message"
          git push -u origin $BRANCHNAME
          echo "::set-output name=branchname::$BRANCHNAME"

      - name: login with gh cli and create the PR
        shell: bash
        run: |
          echo ${{ secrets.GH_PAT }} > ${{ env.GH_TOKEN_FILE }}
          gh auth login --hostname ${{ env.GH_HOST }} \
            --git-protocol ${{ env.GH_PROTOCOL }} \
            --with-token < ${{ env.GH_TOKEN_FILE }}
          rm -rf ${{ env.GH_TOKEN_FILE }}
          cd /tmp/$(basename ${{ matrix.repository }} .git)
          gh pr create -R https://${{ matrix.repository }} \
            --base master --reviewer @MyRepo/myteam \
            --title "${{ env.GH_PR_TITLE }}" \
            --body "${{ env.GH_PR_TITLE }}" \
            --head ${{ env.GH_USERNAME }}:${{ steps.commit-push.outputs.branchname }}

I can verify that origin/foo-` is created

Expected vs actual behavior

A clear and concise description of what you expected to happen and what actually happened.

pull request create failed: GraphQL: Head sha can't be blank, Base sha can't be blank, Head user can't be blank, Head repository can't be blank, No commits between MyRepooe:master and , Head ref must be a branch, not all refs are readable (createPullRequest)

Paste the activity from your command line. Redact if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions