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

Add --skip-download option to print the archive URL rather than download it #17

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

timrogers
Copy link
Contributor

This adds a new --skip-download option to the extension, allowing you to output the archive's URL to stdout rather than automatically downloading it. This is useful if you want to use the URL, rather than use the file.

Due to limitations with gh api, I've been forced to use curl to make the request to the GitHub API to get the archive URL. It isn't possible to do this bit with gh api because it automatically follows the redirect and doesn't give you an opportunity to grab the URL.

@andyfeller
Copy link
Owner

@timrogers : Thanks for opening up this pull request! ✨

Yeah, ideally gh api would offer the ability to disable redirect following like that done in cli/cli#7106 so the user could choose to get the URL versus following it. Going to create an issue to discuss with the maintainers.

Comment on lines +263 to +271
if [[ $GH_HOST != "" ]]; then
if [[ "$GH_HOST" == "github.com" ]]; then
BASE_URL="https://api.github.com"
else
BASE_URL="https://$GH_HOST/api/v3"
fi
else
BASE_URL="https://api.github.com"
fi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know something like this is necessary because the GitHub CLI doesn't expose commands that generate these urls based on the host authenticated and selected here.

Doesn't mean I have to like it 😠

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the same 😦 It feels like it would be great for the CLI to have a way to expose the base URLs.

@timrogers
Copy link
Contributor Author

Yeah, ideally gh api would offer the ability to disable redirect following like that done in cli/cli#7106 so the user could choose to get the URL versus following it. Going to create an issue to discuss with the maintainers.

Agreed!

@andyfeller andyfeller merged commit 614376c into andyfeller:main Sep 29, 2023
@andyfeller
Copy link
Owner

andyfeller commented Sep 29, 2023

@timrogers : thank you again for your contribution! I'll see about cutting a new release with this

https://github.com/andyfeller/gh-repo-export/releases/tag/v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants