fix repo create in org with license/ignore#3924
Merged
Conversation
samcoe
approved these changes
Jun 30, 2021
Contributor
samcoe
left a comment
There was a problem hiding this comment.
This looks good to me, thanks for taking on this work 🙇. I left one non-blocking question.
| } | ||
|
|
||
| if input.GitIgnoreTemplate != "" || input.LicenseTemplate != "" { | ||
| input.Visibility = strings.ToLower(input.Visibility) |
|
|
||
| path := "user/repos" | ||
| if isOrg { | ||
| path = fmt.Sprintf("orgs/%s/repos", ownerName) |
Contributor
There was a problem hiding this comment.
I am pretty sure the answer is no, but can we just use the input.OwnerID here? Seems silly that the API couldn't resolve that.
Contributor
Author
There was a problem hiding this comment.
no, it's a graphql node ID.
Contributor
Author
There was a problem hiding this comment.
but your confusion is warranted! it starts out life as an owner string and is then updated in place to be a node ID.
GypsyQueen99
reviewed
Jul 5, 2021
| // using API v3 here because the equivalent in GraphQL needs `read:org` scope | ||
| func resolveOrganization(client *api.Client, hostname, orgName string) (string, error) { | ||
| func resolveOrganization(client *api.Client, hostname, orgName string) (string, bool, error) { | ||
| var response struct { |
GypsyQueen99
reviewed
Jul 5, 2021
| // using API v3 here because the equivalent in GraphQL needs `read:org` scope | ||
| func resolveOrganization(client *api.Client, hostname, orgName string) (string, error) { | ||
| func resolveOrganization(client *api.Client, hostname, orgName string) (string, bool, error) { | ||
| var response struct { |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3918
This PR detects when a
gh repo create foo/barinvocation targets an org and the user selects a .gitignore/license. In that case we switch to REST, but we have to either pick the user or org version of the REST endpoint.In order to support passing
visibilitywhen using the create org repo endpoint, we need to opt into thenebulapreview.