#5164 HTTP 404 - Unable to create a PR from my fork via API.
Closed: Won't Fix 2 years ago by phracek. Opened 2 years ago by phracek.

By our automatization, https://github.com/sclorg/betka, we are syncing upstream to downstream repositories. All worked fine, but now, I am not able to create a PR.
My fork is this:
https://src.fedoraproject.org/fork/phracek/container/nodejs
and I would like to create a PR via API

the URL is:
https://src.fedoraproject.org/api/0/fork/phracek/container/nodejs/pull-request/new

The POST method looks like:

pagure_post_action(url=https://src.fedoraproject.org/api/0/fork/phracek/container/nodejs/pull-request/new, data={'title': '[betka-master-sync]', 'branch_to': 'f31', 'branch_from': 'f31', 'initial_comment': '\n\nUpstreamCommitID: 697f534804595de0de062b2bcb455b2948bddcad\nUpstreamCommitLink: https://github.com/sclorg/s2i-nodejs-container/commit/697f534804595de0de062b2bcb455b2948bddcad\nUpstreamRepository: https://github.com/sclorg/s2i-nodejs-container', 'repo_from': 'nodejs', 'repo_from_namespace': 'container', 'repo_from_username': 'phracek'})
[2021-05-20 13:03:40,333: ERROR/ForkPoolWorker-1] 404 Client Error: NOT FOUND for url: https://src.fedoraproject.org/api/0/fork/phracek/container/nodejs/pull-request/new
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/betka/pagure.py", line 81, in pagure_post_action
    r.raise_for_status()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: https://src.fedoraproject.org/api/0/fork/phracek/container/nodejs/pull-request/new

I have forgotten to mention, that API is valid till 2022-10-29

Token ACLs are:

    Fork a project
    Modify an existing project
    Comment on a pull-request
    Open a new pull-request
    Flag a pull-request
    Merge a pull-request
    Update the watch status on a project

API like for getting branches work fine:

https://src.fedoraproject.org:443 "GET /api/0/container/nodejs/git/branches HTTP/1.1" 200 241

{'branches': ['6', '8', 'f25', 'f26', 'f27', 'f28', 'f29', 'f30', 'f31', 'f32', 'f33', 'f34', 'main', 'rawhide'], 'default': 'rawhide', 'total_branches': 14}

You seem to try to open the PR against your fork. Forks have PRs disabled by
default. Did you enable them?

Or do you want to open the PR against the main project? If so, you need to
change the URL to the one of the main project.

Hi @pingou , in OSCI all work properly. <OSCI>/api/0/fork/{user}/{namespace}/{repo}/pull-request/new" creates a PR in the main project. But there is an old Pagure.IO instance v5.3, but in SRC.FP.OR is version 5.13.2

I would like to create PR against the main project https://src.fedoraproject.org/container/nodejs
It means from my fork from branch f31 to the main project into branch f31.

The API URL should be https://src.fedoraproject.org/api/0/container/nodejs/pull-request/new ?

I would like to create PR against the main project https://src.fedoraproject.org/container/nodejs
It means from my fork from branch f31 to the main project into branch f31.

The API URL should be https://src.fedoraproject.org/api/0/container/nodejs/pull-request/new ?

Correct, and then the repo_from, repo_from_username and repo_from_namespace (and
branch_from) are used to refer to your fork :)

@pingou repo_from is 'nodejs' and repo_from_namespace is 'container'. This is clear.
repo_from_username is fork name 'phracek' or something else?

Thank you in advance. Hopefully last question.

Thanks for your help with this issue. Closing.

Metadata Update from @phracek:
- Issue close_status updated to: Won't Fix
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata