mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-26 00:50:48 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
100e23f1d0 | ||
|
|
ee46a3debe | ||
|
|
5729c89463 | ||
|
|
b572a9de6f | ||
|
|
abf895aa42 | ||
|
|
f3e04cf24a | ||
|
|
bcdb46af7d | ||
|
|
a5ddc5a290 | ||
|
|
e2ceb8a503 | ||
|
|
4222c00e29 |
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -42,6 +42,7 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-24.04
|
||||
- os: ubuntu-22.04
|
||||
tool: major.minor.patch
|
||||
- os: ubuntu-22.04
|
||||
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -10,6 +10,20 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.40.2] - 2024-06-21
|
||||
|
||||
- Update `zola@latest` to 0.19.0.
|
||||
|
||||
- Update `wasmtime@latest` to 22.0.0.
|
||||
|
||||
## [2.40.1] - 2024-06-20
|
||||
|
||||
- Update `cargo-zigbuild@latest` to 0.19.0.
|
||||
|
||||
- Update `cargo-binstall@latest` to 1.7.2.
|
||||
|
||||
- Update `biome@latest` to 1.8.2.
|
||||
|
||||
## [2.40.0] - 2024-06-19
|
||||
|
||||
- Fix an installation issue on some container environments. ([#545](https://github.com/taiki-e/install-action/pull/545))
|
||||
@@ -2356,7 +2370,9 @@ Note: This release is considered a breaking change because installing on version
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.40.0...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.40.2...HEAD
|
||||
[2.40.2]: https://github.com/taiki-e/install-action/compare/v2.40.1...v2.40.2
|
||||
[2.40.1]: https://github.com/taiki-e/install-action/compare/v2.40.0...v2.40.1
|
||||
[2.40.0]: https://github.com/taiki-e/install-action/compare/v2.39.2...v2.40.0
|
||||
[2.39.2]: https://github.com/taiki-e/install-action/compare/v2.39.1...v2.39.2
|
||||
[2.39.1]: https://github.com/taiki-e/install-action/compare/v2.39.0...v2.39.1
|
||||
|
||||
26
manifests/biome.json
generated
26
manifests/biome.json
generated
@@ -36,13 +36,33 @@
|
||||
},
|
||||
"license_markdown": "[Apache-2.0](https://github.com/biomejs/biome/blob/main/LICENSE-APACHE) OR [MIT](https://github.com/biomejs/biome/blob/main/LICENSE-MIT)",
|
||||
"latest": {
|
||||
"version": "1.8.1"
|
||||
"version": "1.8.2"
|
||||
},
|
||||
"1": {
|
||||
"version": "1.8.1"
|
||||
"version": "1.8.2"
|
||||
},
|
||||
"1.8": {
|
||||
"version": "1.8.1"
|
||||
"version": "1.8.2"
|
||||
},
|
||||
"1.8.2": {
|
||||
"x86_64_linux_musl": {
|
||||
"checksum": "0971bc636e1abc6d06ea03b219f6c78488b209f8a623de081a04ce610ae47f10"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"checksum": "17b1ecae7751c4519135fd4f6d9b7d8cdcf5dbdaa7d586da8776e05ad05209d3"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "cffd0c862eb02b0c574a550ac47c213e0d48121fee23ffcaee4098de08cbdab8"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"checksum": "4467475395c09442c23efca6bc800f8db14f21791ffc77594f71c11ec9c85aa3"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"checksum": "659db94f30b4a5ef80995d494c7e7ec9a7fe820d4ef5b07b0684f2a44fe22140"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"checksum": "ea3c0de73e3f7aa1b95cf5e26694a5427914771e2f47f7b5e5742a16c19088e1"
|
||||
}
|
||||
},
|
||||
"1.8.1": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
16
manifests/cargo-binstall.json
generated
16
manifests/cargo-binstall.json
generated
@@ -22,26 +22,26 @@
|
||||
},
|
||||
"license_markdown": "[GPL-3.0](https://github.com/cargo-bins/cargo-binstall/blob/HEAD/crates/bin/LICENSE)",
|
||||
"latest": {
|
||||
"version": "1.7.1"
|
||||
"version": "1.7.2"
|
||||
},
|
||||
"1.7.1": {
|
||||
"1.7.2": {
|
||||
"x86_64_linux_musl": {
|
||||
"checksum": "3a2f849becb60f070e416cc30d48f366d040c8db38dd7dda714f26cec15f4e2a"
|
||||
"checksum": "08b6969c86471ecd1b9b6fbbd6508014d22dadda29fdd47ffb871d297ac49a8b"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"checksum": "e68cd4c7688ee0378f63c2718c3ff982da02f161f1b9d20d7ecefa26fc463abd"
|
||||
"checksum": "7fa85fd3fda3c9e4962f16f8b9400e97ff2773e0481fc63a9cb882fe80115b7f"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "a6abfc2279632c85db91fb49cd11fd3e1cf8bd4bd4e6f64abc6cc22bcef55d4c"
|
||||
"checksum": "ee4da8bfaf25c84f0b67d5fd8e96f1243df4379f8dad64ffe2f82416198b7b35"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"checksum": "93fbed7fb5ec054fb134a8b31a3d0c6e86dd856b85dce5f63dd4438153a20779"
|
||||
"checksum": "4342cfa8dc1033d2942270e8c4f7a63ef6953632ec3dbfacd7bebd4894e2ece8"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"checksum": "76a4f22e19111d9a6393fa1c60131951646067bb37093d7103cecad8d4ac7d14"
|
||||
"checksum": "68157004ca95c2c3d4fae16246751317d2d6be32911cbdb04a06580d0c3aa43e"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"checksum": "46e3050690269ac6b53b8fed4b8828d2acd9ae72da72270b4d1ccb1824b394b4"
|
||||
"checksum": "baf1c6d5729b629015e199e7739a4f76bd40d9c4a90883ecb1d2c33c16240190"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
manifests/cargo-zigbuild.json
generated
22
manifests/cargo-zigbuild.json
generated
@@ -19,7 +19,27 @@
|
||||
},
|
||||
"license_markdown": "[MIT](https://github.com/rust-cross/cargo-zigbuild/blob/main/LICENSE)",
|
||||
"latest": {
|
||||
"version": "0.18.4"
|
||||
"version": "0.19.0"
|
||||
},
|
||||
"0.19": {
|
||||
"version": "0.19.0"
|
||||
},
|
||||
"0.19.0": {
|
||||
"x86_64_linux_musl": {
|
||||
"checksum": "ab2e2f3a22409470ec7d71badc22ab89351a6ddaba5c4785a39689856809404c"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "640b03357f568deb976cd0e0732db04f723498a0d4706d71ebaec05f8fc35db2"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"checksum": "edc3d0966ed8c80056d36ace8998eb75ed2f3a71342e0825960d98c9eb3398a0"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"checksum": "9173594204eaacadd62e2f26a3c2365887ec24a4fa15f309023b8d4bbbc09dec"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"checksum": "6affe535f6d37768cc20be30b8b65a1bcc196ae1efdad71d2a5c44049a081b7e"
|
||||
}
|
||||
},
|
||||
"0.18": {
|
||||
"version": "0.18.4"
|
||||
|
||||
25
manifests/wasmtime.json
generated
25
manifests/wasmtime.json
generated
@@ -24,7 +24,30 @@
|
||||
},
|
||||
"license_markdown": "[Apache-2.0 WITH LLVM-exception](https://github.com/bytecodealliance/wasmtime/blob/main/LICENSE)",
|
||||
"latest": {
|
||||
"version": "21.0.1"
|
||||
"version": "22.0.0"
|
||||
},
|
||||
"22": {
|
||||
"version": "22.0.0"
|
||||
},
|
||||
"22.0": {
|
||||
"version": "22.0.0"
|
||||
},
|
||||
"22.0.0": {
|
||||
"x86_64_linux_gnu": {
|
||||
"checksum": "415d09d77f5375a6c5f6a1fc102bbaf3fe8e830b438690e6ea59a7d690458dea"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"checksum": "2d39c488e391c1e18875a0aa22db0f2b3c737002beb83712639ff608666fccea"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "87c9d8dd42cc5506edbe9736fb098f8d960606c85d4608d543dd07f79194f35e"
|
||||
},
|
||||
"aarch64_linux_gnu": {
|
||||
"checksum": "0c4bc38070d856a6cfc4b4ec6344b1f5de8cffdde875550c285010d645f24330"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"checksum": "891552cd21d08f330b872ef462bd7ac3903b668f4461cf0de0d16a175b40f57f"
|
||||
}
|
||||
},
|
||||
"21": {
|
||||
"version": "21.0.1"
|
||||
|
||||
19
manifests/zola.json
generated
19
manifests/zola.json
generated
@@ -16,7 +16,24 @@
|
||||
},
|
||||
"license_markdown": "[MIT](https://github.com/getzola/zola/blob/master/LICENSE)",
|
||||
"latest": {
|
||||
"version": "0.18.0"
|
||||
"version": "0.19.0"
|
||||
},
|
||||
"0.19": {
|
||||
"version": "0.19.0"
|
||||
},
|
||||
"0.19.0": {
|
||||
"x86_64_linux_gnu": {
|
||||
"checksum": "5d26b7c63d36bcfc42a2db41d35cdd7bbde1762571ee936a89d155d7fd600f77"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"checksum": "96cc5501541cc220c0e3d234f5c8b869afbba90ff6a10923824dfbb51f87f487"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"checksum": "831adf641d2c691aa95771285f13fdbff8897d481084b360c49a9d933e81cec8"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"checksum": "c57d5c6b6ed55fa1eb04ed8bc17432bff9d0ca0d96558c0c476edbef7fc77d95"
|
||||
}
|
||||
},
|
||||
"0.18": {
|
||||
"version": "0.18.0"
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::{
|
||||
ffi::OsStr,
|
||||
io::Read,
|
||||
path::Path,
|
||||
sync::{LazyLock, RwLock},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
@@ -28,6 +29,7 @@ fn main() -> Result<()> {
|
||||
std::process::exit(1);
|
||||
}
|
||||
let package = &args[0];
|
||||
let version_req = args.get(1);
|
||||
let skip_existing_manifest_versions = std::env::var("SKIP_EXISTING_MANIFEST_VERSIONS").is_ok();
|
||||
|
||||
let workspace_root = &workspace_root();
|
||||
@@ -47,22 +49,22 @@ fn main() -> Result<()> {
|
||||
.strip_prefix("https://github.com/")
|
||||
.context("repository must start with https://github.com/")?;
|
||||
|
||||
eprintln!("downloading metadata from https://github.com/{repo}");
|
||||
|
||||
eprintln!("downloading metadata from https://api.github.com/repos/{repo}");
|
||||
let repo_info: github::RepoMetadata =
|
||||
download_github(&format!("https://api.github.com/repos/{repo}"))?.into_json()?;
|
||||
download(&format!("https://api.github.com/repos/{repo}"))?.into_json()?;
|
||||
|
||||
eprintln!("downloading releases of https://github.com/{repo} from https://api.github.com/repos/{repo}/releases");
|
||||
eprintln!("downloading releases from https://api.github.com/repos/{repo}/releases");
|
||||
let mut releases: github::Releases = vec![];
|
||||
// GitHub API returns up to 100 results at a time. If the number of releases
|
||||
// is greater than 100, multiple fetches are needed.
|
||||
for page in 1.. {
|
||||
let per_page = 100;
|
||||
let mut r: github::Releases = download_github(&format!(
|
||||
let mut r: github::Releases = download(&format!(
|
||||
"https://api.github.com/repos/{repo}/releases?per_page={per_page}&page={page}"
|
||||
))?
|
||||
.into_json()?;
|
||||
if r.len() < per_page {
|
||||
// If version_req is latest, it is usually sufficient to look at the latest 100 releases.
|
||||
if r.len() < per_page || version_req.map_or(false, |req| req == "latest") {
|
||||
releases.append(&mut r);
|
||||
break;
|
||||
}
|
||||
@@ -172,7 +174,7 @@ fn main() -> Result<()> {
|
||||
if let Some(license) = detail.license {
|
||||
eprintln!("Trying to using license '{license}' from crates.io ...");
|
||||
if let Some(license_markdown) =
|
||||
get_license_markdown(&license, &repo.to_string(), &repo_info.default_branch)
|
||||
get_license_markdown(&license, repo, &repo_info.default_branch)
|
||||
{
|
||||
manifests.license_markdown = license_markdown;
|
||||
}
|
||||
@@ -181,7 +183,7 @@ fn main() -> Result<()> {
|
||||
if let Some(license) = license.spdx_id {
|
||||
eprintln!("Trying to using license '{license}' from github.com ...");
|
||||
if let Some(license_markdown) =
|
||||
get_license_markdown(&license, &repo.to_string(), &repo_info.default_branch)
|
||||
get_license_markdown(&license, repo, &repo_info.default_branch)
|
||||
{
|
||||
manifests.license_markdown = license_markdown;
|
||||
}
|
||||
@@ -192,7 +194,7 @@ fn main() -> Result<()> {
|
||||
panic!("Unable to determine license_markdown; set manually")
|
||||
}
|
||||
|
||||
let version_req: Option<semver::VersionReq> = match args.get(1) {
|
||||
let version_req: Option<semver::VersionReq> = match version_req {
|
||||
_ if latest_only => {
|
||||
let req = format!("={}", releases.first_key_value().unwrap().0 .0).parse()?;
|
||||
eprintln!("update manifest for versions '{req}'");
|
||||
@@ -294,7 +296,7 @@ fn main() -> Result<()> {
|
||||
eprintln!("already downloaded");
|
||||
fs::File::open(download_cache)?.read_to_end(&mut buf)?;
|
||||
} else {
|
||||
download_github(&url)?.into_reader().read_to_end(&mut buf)?;
|
||||
download(&url)?.into_reader().read_to_end(&mut buf)?;
|
||||
eprintln!("download complete");
|
||||
fs::write(download_cache, &buf)?;
|
||||
}
|
||||
@@ -316,7 +318,7 @@ fn main() -> Result<()> {
|
||||
eprintln!("already downloaded");
|
||||
minisign_verify::Signature::from_file(sig_download_cache)?
|
||||
} else {
|
||||
let buf = download_github(&url)?.into_string()?;
|
||||
let buf = download(&url)?.into_string()?;
|
||||
eprintln!("download complete");
|
||||
fs::write(sig_download_cache, &buf)?;
|
||||
minisign_verify::Signature::decode(&buf)?
|
||||
@@ -606,97 +608,131 @@ fn replace_vars(
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
/// Download using GITHUB_TOKEN.
|
||||
#[allow(clippy::missing_panics_doc)]
|
||||
fn download_github(url: &str) -> Result<ureq::Response> {
|
||||
let mut token = env::var("GITHUB_TOKEN").ok().filter(|v| !v.is_empty());
|
||||
struct GitHubTokens {
|
||||
// In my experience, only api.github.com have severe rate limit.
|
||||
// https://api.github.com/
|
||||
// Refs: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api
|
||||
api: RwLock<Option<String>>,
|
||||
// https://raw.githubusercontent.com/
|
||||
// Refs: https://stackoverflow.com/questions/66522261/does-github-rate-limit-access-to-public-raw-files
|
||||
raw: RwLock<Option<String>>,
|
||||
// https://github.com/*/*/releases/download/
|
||||
other: RwLock<Option<String>>,
|
||||
}
|
||||
impl GitHubTokens {
|
||||
fn get(&self, url: &str) -> Option<String> {
|
||||
if url.starts_with("https://raw.githubusercontent.com/") {
|
||||
self.raw.read().unwrap().clone()
|
||||
} else if url.starts_with("https://api.github.com/") {
|
||||
self.api.read().unwrap().clone()
|
||||
} else if url.starts_with("https://github.com/") {
|
||||
self.other.read().unwrap().clone()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
fn clear(&self, url: &str) {
|
||||
if url.starts_with("https://raw.githubusercontent.com/") {
|
||||
*self.raw.write().unwrap() = None;
|
||||
} else if url.starts_with("https://api.github.com/") {
|
||||
*self.api.write().unwrap() = None;
|
||||
} else if url.starts_with("https://github.com/") {
|
||||
*self.other.write().unwrap() = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
static GITHUB_TOKENS: LazyLock<GitHubTokens> = LazyLock::new(|| {
|
||||
let token = env::var("GITHUB_TOKEN").ok().filter(|v| !v.is_empty());
|
||||
GitHubTokens {
|
||||
raw: RwLock::new(token.clone()),
|
||||
api: RwLock::new(token.clone()),
|
||||
other: RwLock::new(token),
|
||||
}
|
||||
});
|
||||
|
||||
fn download(url: &str) -> Result<ureq::Response> {
|
||||
let mut token = GITHUB_TOKENS.get(url);
|
||||
let mut retry = 0;
|
||||
let max_retry = 6;
|
||||
let mut retry_time = 0;
|
||||
let mut max_retry = 6;
|
||||
if token.is_none() {
|
||||
max_retry /= 2;
|
||||
}
|
||||
let mut last_error;
|
||||
loop {
|
||||
let mut req = ureq::get(url);
|
||||
if let Some(token) = &token {
|
||||
req = req.set("Authorization", token);
|
||||
req = req.set("Authorization", &format!("Bearer {token}"));
|
||||
}
|
||||
match req.call() {
|
||||
Ok(res) => return Ok(res),
|
||||
Err(e) => last_error = Some(e),
|
||||
}
|
||||
if retry == max_retry / 2 && token.is_some() {
|
||||
retry_time += 1;
|
||||
if token.is_some() && retry == max_retry / 2 {
|
||||
retry_time = 0;
|
||||
token = None;
|
||||
// rate limit
|
||||
GITHUB_TOKENS.clear(url);
|
||||
}
|
||||
retry += 1;
|
||||
if retry > max_retry {
|
||||
break;
|
||||
}
|
||||
eprintln!("download failed; retrying after {}s ({retry}/{max_retry})", retry * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry * 2));
|
||||
eprintln!("download failed; retrying after {}s ({retry}/{max_retry})", retry_time * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry_time * 2));
|
||||
}
|
||||
Err(last_error.unwrap().into())
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_panics_doc)]
|
||||
pub fn github_head(url: &str) -> Result<()> {
|
||||
fn github_head(url: &str) -> Result<()> {
|
||||
eprintln!("fetching head of {url} ..");
|
||||
let mut token = env::var("GITHUB_TOKEN").ok().filter(|v| !v.is_empty());
|
||||
let mut token = GITHUB_TOKENS.get(url);
|
||||
let mut retry = 0;
|
||||
let max_retry = 2;
|
||||
let mut retry_time = 0;
|
||||
let mut max_retry = 2;
|
||||
if token.is_none() {
|
||||
max_retry /= 2;
|
||||
}
|
||||
let mut last_error;
|
||||
loop {
|
||||
let mut req = ureq::head(url);
|
||||
if let Some(token) = &token {
|
||||
req = req.set("Authorization", token);
|
||||
req = req.set("Authorization", &format!("Bearer {token}"));
|
||||
}
|
||||
match req.call() {
|
||||
Ok(_) => return Ok(()),
|
||||
Err(e) => last_error = Some(e),
|
||||
// rate limit
|
||||
Err(e @ ureq::Error::Status(403, _)) => last_error = Some(e),
|
||||
Err(e) => return Err(e.into()),
|
||||
}
|
||||
if retry == max_retry / 2 && token.is_some() {
|
||||
retry_time += 1;
|
||||
if token.is_some() && retry == max_retry / 2 {
|
||||
retry_time = 0;
|
||||
token = None;
|
||||
GITHUB_TOKENS.clear(url);
|
||||
}
|
||||
retry += 1;
|
||||
if retry > max_retry {
|
||||
break;
|
||||
}
|
||||
eprintln!("head of {url} failed; retrying after {}s ({retry}/{max_retry})", retry * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry * 2));
|
||||
}
|
||||
Err(last_error.unwrap().into())
|
||||
}
|
||||
|
||||
/// Download without using GITHUB_TOKEN.
|
||||
#[allow(clippy::missing_panics_doc)]
|
||||
pub fn download(url: &str) -> Result<ureq::Response> {
|
||||
let mut retry = 0;
|
||||
let max_retry = 6;
|
||||
let mut last_error;
|
||||
loop {
|
||||
let req = ureq::get(url);
|
||||
match req.call() {
|
||||
Ok(res) => return Ok(res),
|
||||
Err(e) => last_error = Some(e),
|
||||
}
|
||||
retry += 1;
|
||||
if retry > max_retry {
|
||||
break;
|
||||
}
|
||||
eprintln!("download of {url} failed; retrying after {}s ({retry}/{max_retry})", retry * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry * 2));
|
||||
eprintln!("head of {url} failed; retrying after {}s ({retry}/{max_retry})", retry_time * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry_time * 2));
|
||||
}
|
||||
Err(last_error.unwrap().into())
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn create_github_raw_link(repository: &String, branch: &String, filename: &String) -> String {
|
||||
fn create_github_raw_link(repository: &str, branch: &str, filename: &str) -> String {
|
||||
format!("https://raw.githubusercontent.com/{repository}/{branch}/{filename}")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn create_github_link(repository: &String, branch: &String, filename: &String) -> String {
|
||||
fn create_github_link(repository: &str, branch: &str, filename: &str) -> String {
|
||||
format!("https://github.com/{repository}/blob/{branch}/{filename}")
|
||||
}
|
||||
#[must_use]
|
||||
fn get_license_markdown(spdx_expr: &str, repo: &String, default_branch: &String) -> Option<String> {
|
||||
fn get_license_markdown(spdx_expr: &str, repo: &str, default_branch: &str) -> Option<String> {
|
||||
// TODO: use https://docs.rs/spdx/latest/spdx/expression/struct.Expression.html#method.canonicalize ?
|
||||
let expr = spdx::Expression::parse_mode(spdx_expr, spdx::ParseMode::LAX).unwrap();
|
||||
|
||||
@@ -740,14 +776,14 @@ fn get_license_markdown(spdx_expr: &str, repo: &String, default_branch: &String)
|
||||
let license_name = if let Some(exception_id) = exception_id {
|
||||
format!("{} WITH {}", license_id.name, exception_id.name)
|
||||
} else {
|
||||
license_id.name.to_string()
|
||||
license_id.name.to_owned()
|
||||
};
|
||||
let name = license_id.name.split('-').next().unwrap().to_ascii_uppercase();
|
||||
for filename in [
|
||||
"LICENSE".to_string(),
|
||||
"LICENSE".to_owned(),
|
||||
format!("LICENSE-{name}"),
|
||||
"LICENSE.md".to_string(),
|
||||
"COPYING".to_string(),
|
||||
"LICENSE.md".to_owned(),
|
||||
"COPYING".to_owned(),
|
||||
] {
|
||||
let url = create_github_raw_link(repo, default_branch, &filename);
|
||||
if github_head(&url).is_ok() {
|
||||
@@ -765,7 +801,7 @@ fn get_license_markdown(spdx_expr: &str, repo: &String, default_branch: &String)
|
||||
let license_name = if let Some(exception_id) = exception_id {
|
||||
format!("{} WITH {}", license_id.name, exception_id.name)
|
||||
} else {
|
||||
license_id.name.to_string()
|
||||
license_id.name.to_owned()
|
||||
};
|
||||
if github_head(&url).is_ok() {
|
||||
let url = create_github_link(repo, default_branch, &filename);
|
||||
|
||||
@@ -46,16 +46,16 @@ fn main() -> Result<()> {
|
||||
paths.sort_by_key(fs_err::DirEntry::path);
|
||||
|
||||
let mut tools = vec"
|
||||
.to_string(),
|
||||
.to_owned(),
|
||||
}];
|
||||
|
||||
for path in paths {
|
||||
|
||||
Reference in New Issue
Block a user