Skip to content

add GitHub URL parsing utility function #380

Description

@gmlewis

It seems that clients of this package frequently need to parse GitHub URLs in order to validate and/or extract useful information from them. It would be nice to have all this code deduplicated into a single, central location, and this package might be a nice home for it.

Maybe something like:

func ParseURL(url string) (owner, repo, ref string, err error) {...}

Common URLs to parse could be ones similar to:

https://github.com/bazelbuild/bazel/tree/master
https://github.com/bazelbuild/bazel/tree/master
https://www.github.com/bazelbuild/bazel/tree/master
https://github.com/bazelbuild/bazel/releases/tag/0.2.1
https://github.com/bazelbuild/bazel/commit/19b5675725caf69008a717082149237400260edc
https://github.com/bazelbuild/bazel/archive/0.2.1.zip

Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions