mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-19 09:06:36 +00:00
Ret artifact url in has_release_artifact
So that we can use it to download from private repositories. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
d2914cca42
commit
0708f6f348
4 changed files with 22 additions and 16 deletions
|
@ -20,6 +20,7 @@ use super::{percent_encode_http_url_path, remote, GhApiError, GhGraphQLErrors, G
|
|||
#[derive(Eq, Deserialize, Debug)]
|
||||
struct Artifact {
|
||||
name: CompactString,
|
||||
url: CompactString,
|
||||
}
|
||||
|
||||
// Manually implement PartialEq and Hash to ensure it will always produce the
|
||||
|
@ -57,8 +58,11 @@ pub(super) struct Artifacts {
|
|||
}
|
||||
|
||||
impl Artifacts {
|
||||
pub(super) fn contains(&self, artifact_name: &str) -> bool {
|
||||
self.assets.contains(artifact_name)
|
||||
/// get url for downloading the artifact using GitHub API (for private repository).
|
||||
pub(super) fn get_artifact_url(&self, artifact_name: &str) -> Option<CompactString> {
|
||||
self.assets
|
||||
.get(artifact_name)
|
||||
.map(|artifact| artifact.url.clone())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +205,10 @@ query {{
|
|||
repository(owner:"{owner}",name:"{repo}") {{
|
||||
release(tagName:"{tag}") {{
|
||||
releaseAssets({cond}) {{
|
||||
nodes {{ name }}
|
||||
nodes {{
|
||||
name
|
||||
url
|
||||
}}
|
||||
pageInfo {{ endCursor hasNextPage }}
|
||||
}}
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue