Skip to content

Conversation

@markg-github
Copy link
Contributor

Allow asset download from private repos: use URL with asset ID, supply token, etc.
Use --public to download in a way (the old way) that only works for public repos.

Resolves: #18

Copilot AI review requested due to automatic review settings December 6, 2025 14:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables downloading release assets from private GitHub repositories by using asset IDs and authentication tokens, while maintaining backward compatibility for public repos via a --public flag.

Key Changes:

  • Added authentication support using GitHub tokens for private repository access
  • Introduced --public flag to preserve original public-only download behavior
  • Modified asset download logic to use asset ID-based URLs for private repos

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/github.rs Added id field to Asset struct, --public flag, and helper methods for repo metadata and token access
src/http/server.rs Added authentication headers to HTTP client when accessing private repositories
src/http/service.rs Implemented request builder with private/public repo logic and response inspection utilities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +184 to +179
let (_status_code, _content_length) =
Self::inspect_response(&resp);
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

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

The inspect_response call extracts status code and content length but doesn't use them (indicated by underscore prefix). If these values aren't needed for error handling or logging, consider removing this call.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@markg-github is there a reason for not removing these? I agree w/ the copilot comments that I can't see why we'd want to inspect the response if nothing is done with the contents. Was this done for debug and then forgot to remove? The original implementation was pretty nice and concise.

_ => client.get(url), // fallback; you only use HEAD/GET here
};

if gh.is_private() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be removed after you fix the other accept header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Thanks.

Use --public to download in a way (the old way) that only works for public repos.

Resolves: AMDEPYC#18
Copilot AI review requested due to automatic review settings December 16, 2025 21:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +153 to +154
let (_status_code, _content_length) =
Self::inspect_response(&resp);
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The inspect_response function is called but its return values are unused (indicated by the underscore prefix). Consider removing this function call if the values aren't needed, or remove the underscores if they will be used in future iterations.

Suggested change
let (_status_code, _content_length) =
Self::inspect_response(&resp);
// Removed unused inspect_response call

Copilot uses AI. Check for mistakes.
Comment on lines +178 to +179
let (_status_code, _content_length) =
Self::inspect_response(&resp);
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The inspect_response function is called but its return values are unused (indicated by the underscore prefix). Consider removing this function call if the values aren't needed, or remove the underscores if they will be used in future iterations.

Suggested change
let (_status_code, _content_length) =
Self::inspect_response(&resp);
// Removed unused inspect_response call

Copilot uses AI. Check for mistakes.
status,
github,
client: Client::builder().redirect(policy).build()?,
client: client_builder.build()?,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason that private would not need the redirect policy? Otherwise I think you keep the redirect() call here and remove the one at the top.

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.

dispatch doesn't work with private GitHub repos

2 participants