Skip to content

Commit 6e3b572

Browse files
committed
fix: filter 7z in mingw asset list
1 parent 3e4a96d commit 6e3b572

10 files changed

+25
-11
lines changed

dist/legacy/github_brechtsanders_winlibs_mingw.json

+1-1
Large diffs are not rendered by default.

dist/legacy/setup-cpp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/github_brechtsanders_winlibs_mingw.json

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

+1-1
Large diffs are not rendered by default.

src/gcc/assets-list.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { saveGitHubAssetList } from "../utils/github/fetch-assets.ts"
55
*/
66
async function main() {
77
// https://github.com/brechtsanders/winlibs_mingw/releases
8-
await saveGitHubAssetList("brechtsanders", "winlibs_mingw", "./src/gcc/github_brechtsanders_winlibs_mingw.json")
8+
await saveGitHubAssetList(
9+
"brechtsanders",
10+
"winlibs_mingw",
11+
"./src/gcc/github_brechtsanders_winlibs_mingw.json",
12+
(asset) => asset.endsWith(".7z"),
13+
)
914
}
1015

1116
main().catch((err) => {

src/gcc/gcc.ts

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ async function getGccPackageInfo(version: string, platform: NodeJS.Platform, arc
4141
: arch === "ia32"
4242
? "i386"
4343
: arch,
44-
filterName: (name) => name.endsWith(".7z"),
4544
},
4645
)
4746

src/gcc/github_brechtsanders_winlibs_mingw.json

+1-1
Large diffs are not rendered by default.

src/utils/github/fetch-assets.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ import type { Assets } from "./load-assets.ts"
1111
* @param prerelease Whether to include prereleases
1212
*/
1313

14-
async function fetchGitHubAssetList(owner: string, repo: string, prerelease = false) {
14+
async function fetchGitHubAssetList(
15+
owner: string,
16+
repo: string,
17+
filterAssets?: (asset: string) => boolean,
18+
prerelease = false,
19+
) {
1520
const octokit = new Octokit({
1621
auth: process.env.GITHUB_TOKEN,
1722
})
@@ -47,7 +52,11 @@ async function fetchGitHubAssetList(owner: string, repo: string, prerelease = fa
4752
}
4853

4954
const assets_ref = assets[release.tag_name]
55+
5056
for (const asset of release.assets) {
57+
if (filterAssets !== undefined && !filterAssets(asset.name)) {
58+
continue
59+
}
5160
assets_ref.push(asset.name)
5261
}
5362
}
@@ -67,8 +76,9 @@ export async function saveGitHubAssetList(
6776
owner: string,
6877
repo: string,
6978
path: string,
79+
filterAssets?: (asset: string) => boolean,
7080
) {
71-
const assets = await fetchGitHubAssetList(owner, repo)
81+
const assets = await fetchGitHubAssetList(owner, repo, filterAssets, false)
7282

7383
const jsonStringify = JsonStringify.configure({
7484
deterministic: compareVersion,

0 commit comments

Comments
 (0)