Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating PR #20

Open
yajo opened this issue Apr 4, 2023 · 2 comments
Open

Error creating PR #20

yajo opened this issue Apr 4, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@yajo
Copy link
Member

yajo commented Apr 4, 2023

Module

product_tax_multicompany_default

Describe the bug

It won't create the PR.

To Reproduce

Run:

oca-port --repo-name multi-company --verbose --upstream upstream --fork origin 14.0 16.0 product_tax_multicompany_default

After I tell it to create a draft PR, I get this exception:

        Create a draft PR from 'oca-port-pr-464-from-14.0-to-16.0' to '16.0' against OCA/multi-company? [y/N]: y
Traceback (most recent call last):
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/bin/.oca-port-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/spcxakfs6hg2yrhbxp6c2gkk538q30w0-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/spcxakfs6hg2yrhbxp6c2gkk538q30w0-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/nix/store/spcxakfs6hg2yrhbxp6c2gkk538q30w0-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/spcxakfs6hg2yrhbxp6c2gkk538q30w0-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/lib/python3.10/site-packages/oca_port/__init__.py", line 118, in main
    ).run()
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 94, in run
    self._port_pull_requests(branches_diff)
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 146, in _port_pull_requests
    self._create_pull_request(pr_branch, pr_data, processed_prs)
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 359, in _create_pull_request
    response = misc._request_github(
  File "/nix/store/1v9vvq131m5ddpi37gsiicmpay2xmk57-python3.10-oca-port-0.12/lib/python3.10/site-packages/oca_port/misc.py", line 386, in _request_github
    raise RuntimeError(response.text)
RuntimeError: {"message":"Validation Failed","errors":[{"resource":"PullRequest","field":"head","code":"invalid"}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"}

Expected behavior
PR created.

Additional context
I'm trying to port OCA/multi-company#464 to 16.0.

@yajo yajo added the bug Something isn't working label Apr 4, 2023
@sebalix
Copy link
Collaborator

sebalix commented May 3, 2023

I already seen this error in the past, and I think @simahawk spotted it too...
I made a try and ported your PR 464 successfully: OCA/multi-company#478 (maybe not resolved the conflicts as expected that said, was not the purpose).

Are you using the "last" type of personal GH token that starts with ghp_?

My shell logs:

- Port commits w/o PR...
	Port them? [y/N]: 
	Blacklist this PR? [y/N]: 
- Port PR #340 (https://github.com/OCA/multi-company/pull/340) [MIG][14.0] product_tax_multicompany_default...
	Port it? [y/N]: 
	Blacklist this PR? [y/N]: 
- Port PR #448 (https://github.com/OCA/multi-company/pull/448) [BKP][14.0] product_tax_multicompany_default: Overwrite taxes instead of adding it...
	Port it? [y/N]: 
	Blacklist this PR? [y/N]: 
- Port PR #464 (https://github.com/OCA/multi-company/pull/464) [IMP] product_tax_multicompany_default: beautier and mass propagation...
	Port it? [y/N]: y
	Create branch oca-port-pr-464-from-14.0-to-16.0 from camptocamp/16.0...
		Apply d924a7a6 [IMP] product_tax_multicompany_default: beautier and mass propagation...
ERROR:
Cmd('git') failed due to: exit code(128)
  cmdline: git am -3 --keep /tmp/tmpljgjxvez/0001-IMP-product_tax_multicompany_default-beautier-and-ma.patch
  stdout: 'Applying: [IMP] product_tax_multicompany_default: beautier and mass propagation
Using index info to reconstruct a base tree...
M	product_tax_multicompany_default/models/product.py
M	product_tax_multicompany_default/readme/USAGE.rst
M	product_tax_multicompany_default/tests/test_product_tax_multicompany.py
M	product_tax_multicompany_default/views/product_template_view.xml
Falling back to patching base and 3-way merge...
Auto-merging product_tax_multicompany_default/views/product_template_view.xml
CONFLICT (content): Merge conflict in product_tax_multicompany_default/views/product_template_view.xml
Auto-merging product_tax_multicompany_default/tests/test_product_tax_multicompany.py
CONFLICT (content): Merge conflict in product_tax_multicompany_default/tests/test_product_tax_multicompany.py
Auto-merging product_tax_multicompany_default/models/product.py
Patch failed at 0001 [IMP] product_tax_multicompany_default: beautier and mass propagation
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch'

⚠️  A conflict occurs, please resolve it and confirm to continue the process (y) or skip this commit (N). [y/N]: y
	🎉 Last PR processed! 🎉
	Push branch 'oca-port-pr-464-from-14.0-to-16.0' to remote 'sebalix'? [y/N]: y
	Create a draft PR from 'oca-port-pr-464-from-14.0-to-16.0' to '16.0' against OCA/multi-company? [y/N]: y
		PR created => https://github.com/OCA/multi-company/pull/478

@SirAionTech
Copy link

I am having this same error, here the stack

Details
[...]
- Port PR #1048 (https://github.com/OCA/account-financial-reporting/pull/1048) [FIX] account_financial_report: Empty format...
	Port it? [y/N]: y
	Create branch oca-port-from-14.0-to-16.0-pr-1048 from origin/16.0...
		Apply 6eb8b6d3 [FIX] account_financial_report: Empty format...
	🎉 Last PR processed! 🎉
	Push branch 'oca-port-from-14.0-to-16.0-pr-1048' to remote 'SirAionTech'? [y/N]: y
	Create a draft PR from 'oca-port-from-14.0-to-16.0-pr-1048' to '16.0' against OCA/account-financial-reporting? [y/N]: y
Traceback (most recent call last):
  File "/path/to/.local/bin/oca-port", line 8, in 
    sys.exit(main())
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/cli/main.py", line 151, in main
    app.run()
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/app.py", line 167, in run
    output = self.run_port()
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/app.py", line 184, in run_port
    return PortAddonPullRequest(self).run()
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 90, in run
    self._port_pull_requests(branches_diff)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 147, in _port_pull_requests
    self._create_pull_request(pr_branch, pr_data, processed_prs)
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/port_addon_pr.py", line 382, in _create_pull_request
    response = github.request(
  File "/path/to/.local/pipx/venvs/oca-port/lib/python3.10/site-packages/oca_port/utils/github.py", line 28, in request
    raise RuntimeError(response.text)
RuntimeError: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

reading the above comment reminds me that I did not supply a token, my bad, but maybe the error could point to that instead of raising a generic error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants