fix: filter 7z in mingw asset list

This commit is contained in:
Amin Yahyaabadi 2024-09-04 02:03:02 -07:00
parent 3e4a96d3c7
commit 6e3b572a56
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
10 changed files with 25 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,12 @@ import { saveGitHubAssetList } from "../utils/github/fetch-assets.ts"
*/
async function main() {
// https://github.com/brechtsanders/winlibs_mingw/releases
await saveGitHubAssetList("brechtsanders", "winlibs_mingw", "./src/gcc/github_brechtsanders_winlibs_mingw.json")
await saveGitHubAssetList(
"brechtsanders",
"winlibs_mingw",
"./src/gcc/github_brechtsanders_winlibs_mingw.json",
(asset) => asset.endsWith(".7z"),
)
}
main().catch((err) => {

View File

@ -41,7 +41,6 @@ async function getGccPackageInfo(version: string, platform: NodeJS.Platform, arc
: arch === "ia32"
? "i386"
: arch,
filterName: (name) => name.endsWith(".7z"),
},
)

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,12 @@ import type { Assets } from "./load-assets.ts"
* @param prerelease Whether to include prereleases
*/
async function fetchGitHubAssetList(owner: string, repo: string, prerelease = false) {
async function fetchGitHubAssetList(
owner: string,
repo: string,
filterAssets?: (asset: string) => boolean,
prerelease = false,
) {
const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
})
@ -47,7 +52,11 @@ async function fetchGitHubAssetList(owner: string, repo: string, prerelease = fa
}
const assets_ref = assets[release.tag_name]
for (const asset of release.assets) {
if (filterAssets !== undefined && !filterAssets(asset.name)) {
continue
}
assets_ref.push(asset.name)
}
}
@ -67,8 +76,9 @@ export async function saveGitHubAssetList(
owner: string,
repo: string,
path: string,
filterAssets?: (asset: string) => boolean,
) {
const assets = await fetchGitHubAssetList(owner, repo)
const assets = await fetchGitHubAssetList(owner, repo, filterAssets, false)
const jsonStringify = JsonStringify.configure({
deterministic: compareVersion,