git-resource icon indicating copy to clipboard operation
git-resource copied to clipboard

Unable to create Github Pull Request using gh CLI client

Open fenech opened this issue 5 years ago • 0 comments

If I fetch code from a repo with a get step and pass the directory as an input to a task, I cannot open a PR using gh pr create --fill. Example task:

inputs: [{name: repo}]
params:
  TOKEN: # access token with write access to the repo and org:read
run:
  path: bash
  dir: repo
  args:
    - -c
    - |
        touch file
        git checkout -B test
        git commit -am test
        git push -u origin test
        gh auth login --with-token <<<"$TOKEN"
        gh pr create --fill

The final command attempts to open a pull request between the new branch and the default branch, but it seems that the repository is incomplete, so it triggers a prompt rather than opening the PR.

Running a git clone within the task works as expected: the PR is opened with no prompt.

fenech avatar Dec 01 '20 07:12 fenech