gruntwork-io / git-xargs

git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
https://blog.gruntwork.io/introducing-git-xargs-an-open-source-tool-to-update-multiple-github-repos-753f9f3675ec
Apache License 2.0
935 stars 62 forks source link

Pull request body validation error #7

Closed zackproser closed 3 years ago

zackproser commented 3 years ago
DEBU[0010] Successfully pushed local branch to remote origin  Repo=terraform-aws-architecture-catalog
DEBU[0011] Error opening Pull request                    Base=master Body="_**This PR was created by git-xargs. See https://github.com/gruntwork-io/prototypes/pull/152 for context.**_ We recently renamed all of our repos to follow the Terraform registry format of  (e.g., ). This PR does a search & replace to update all references to these repos to the new names. GitHub can handle redirects, so in theory, everything should work fine with the old names, but there were so many renames, that to reduce confusion, this will update most of our references to the proper values." Error="POST https://api.github.com/repos/gruntwork-io/terraform-aws-architecture-catalog/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Head=refs/heads/rename-repos
DEBU[0011] Error encountered while processing repo       Error="POST https://api.github.com/repos/gruntwork-io/terraform-aws-architecture-catalog/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Repo name=terraform-aws-architecture-catalog
radicarl commented 3 years ago

Hello,

your tool was exactly what I was looking for, sadly I got the same error:

[git-xargs] DEBU[2021-04-22T14:10:51+02:00] Local repository worktree no longer clean, will stage and add new files and commit changes  Repo=room-management-example Found untracked file new-file.md. Adding to stage
[git-xargs] DEBU[2021-04-22T14:10:53+02:00] Successfully pushed local branch to remote origin  Repo=room-management-example
[git-xargs] DEBU[2021-04-22T14:10:54+02:00] Error opening Pull request                    Base=master Body="Testing git-xargs" Error="POST https://api.github.com/repos/<org>/room-management-example/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Head=refs/heads/testing-git-xargs
[git-xargs] DEBU[2021-04-22T14:10:54+02:00] Error encountered while processing repo       Error="POST https://api.github.com/repos/<org>/room-management-example/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Repo name=room-management-example

Looked into your source and found master as base branch. We already use main as default branch. Maybe thats the problem? Can you make the default branch configurable?

Proposal: Add the branch to the repo string in the repo file like:

gruntwork-io/infrastructure-as-code-training/tree/main
gruntwork-io/infrastructure-live-acme/tree/some-other-branch

This way you could use different base-branches for every repository and the user can copy the url from his browser. Maybe you could ignore https://github.com in the beginning, then the user could just navigate to the branch and copy an paste the url.

zackproser commented 3 years ago

Hello,

your tool was exactly what I was looking for, sadly I got the same error:

[git-xargs] DEBU[2021-04-22T14:10:51+02:00] Local repository worktree no longer clean, will stage and add new files and commit changes  Repo=room-management-example Found untracked file new-file.md. Adding to stage
[git-xargs] DEBU[2021-04-22T14:10:53+02:00] Successfully pushed local branch to remote origin  Repo=room-management-example
[git-xargs] DEBU[2021-04-22T14:10:54+02:00] Error opening Pull request                    Base=master Body="Testing git-xargs" Error="POST https://api.github.com/repos/<org>/room-management-example/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Head=refs/heads/testing-git-xargs
[git-xargs] DEBU[2021-04-22T14:10:54+02:00] Error encountered while processing repo       Error="POST https://api.github.com/repos/<org>/room-management-example/pulls: 422 Validation Failed [{Resource:PullRequest Field:base Code:invalid Message:}]" Repo name=room-management-example

Looked into your source and found master as base branch. We already use main as default branch. Maybe thats the problem? Can you make the default branch configurable?

Proposal: Add the branch to the repo string in the repo file like:

gruntwork-io/infrastructure-as-code-training/tree/main
gruntwork-io/infrastructure-live-acme/tree/some-other-branch

This way you could use different base-branches for every repository and the user can copy the url from his browser. Maybe you could ignore https://github.com in the beginning, then the user could just navigate to the branch and copy an paste the url.

Thanks for the detailed report! Yes, making the base branch configurable is a pretty quick change. I'll look at it as soon as I can.

jphuynh commented 3 years ago

Just realised that a few people have reported that. I had a stab at it to support the default branch https://github.com/gruntwork-io/git-xargs/pull/23

Not fully configurable but should help with most cases I believe. What do you think @zackproser?

radicarl commented 3 years ago

Just realised that a few people have reported that. I had a stab at it to support the default branch #23

Not fully configurable but should help with most cases I believe. What do you think @zackproser?

This would help in my case

zackproser commented 3 years ago

This should have been fixed in https://github.com/gruntwork-io/git-xargs/pull/23 thanks to @jphuynh !

radicarl commented 3 years ago

Thank you, that was fast. My test was successful

zackproser commented 3 years ago

Thank you, that was fast. My test was successful

Awesome - so happy to hear it!