Search code examples
gitgiteatektontekton-pipelines

Git cli pull request - no PR created in the remote repo


After creating a git pull request by CLI, it is not visible in the remote repo. Should I use another push request to update the remote (Gitea) repo?

Context is a Tekton pipeline. I have to work with the command line interface or a Tekton task. The existing PR Tekton task is for GitHub or Gitlab.I work here with a Gitea repo.

First I create a branch 'prod' from the 'master' branch, edit a change, commit the change and push it to the remote repo. Works of course fine.

Then I start a pull request like this:

git request-pull master http://remote-repo.git prod

For more info see this official doc.

In the remote repo the new pull request is not visible. How come?

Do I have to push any branch to the remote repo?

I tried to use origin/master as a parameter, but that is an invalid 'revision'.


Solution

  • There were a few options:

    • Any 'git' remote command: alas, git request-pull does not create a remote pull request.
    • A Tekton (Hub) standard task: there is an existing Pullrequedst task, but it interacts only with Github or Gitlab.
    • Using the Gitea API: that one works! Checked it with a CI/CD expert.

    You can find sufficient information via http://your-gitea-server/api/swagger.

    As an example:

    curl -X 'POST' \
      'https://try.gitea.io/api/v1/repos/pr_api_test/pr_test/pulls?token=apersonalaccesstoken' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "base": "main",
      "head": "content",
      "title": "first pr",
      "body": "This is a PR!"
    }'