Skip to content

Commit 552dc55

Browse files
authored
fix: revert fs:readableWebStream change (#632)
* Revert "fix: fix file closing issue (#629)" This reverts commit 07a2257. * fix: revert `fh.readableWebStream` change Signed-off-by: Rui Chen <[email protected]> --------- Signed-off-by: Rui Chen <[email protected]>
1 parent f3cad8b commit 552dc55

File tree

6 files changed

+14
-22
lines changed

6 files changed

+14
-22
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ updates:
1212
- dependency-name: node-fetch
1313
versions:
1414
- ">=3.0.0"
15-
# ignore mime and @types/mime per https://github.com/softprops/action-gh-release/pull/475
16-
- dependency-name: mime
15+
- dependency-name: "@types/node"
1716
versions:
18-
- ">=4.0.0"
19-
- dependency-name: "@types/mime"
20-
versions:
21-
- ">=4.0.0"
17+
- ">=22.0.0"
2218
commit-message:
2319
prefix: "chore(deps)"
2420
- package-ecosystem: github-actions

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"devDependencies": {
3333
"@types/glob": "^8.1.0",
3434
"@types/mime-types": "^3.0.1",
35-
"@types/node": "^22.15.21",
35+
"@types/node": "^20.17.32",
3636
"@vercel/ncc": "^0.38.3",
3737
"@vitest/coverage-v8": "^3.1.4",
3838
"prettier": "3.5.3",

src/github.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { GitHub } from "@actions/github/lib/utils";
2-
import { Config, isTag, releaseBody, alignAssetName } from "./util";
32
import { statSync } from "fs";
43
import { open } from "fs/promises";
54
import { lookup } from "mime-types";
65
import { basename } from "path";
6+
import { alignAssetName, Config, isTag, releaseBody } from "./util";
77

88
type GitHub = InstanceType<typeof GitHub>;
99

@@ -180,7 +180,6 @@ export const upload = async (
180180
endpoint.searchParams.append("name", name);
181181
const fh = await open(path);
182182
try {
183-
const stream = fh.readableWebStream();
184183
const resp = await github.request({
185184
method: "POST",
186185
url: endpoint.toString(),
@@ -189,7 +188,7 @@ export const upload = async (
189188
"content-type": mime,
190189
authorization: `token ${config.github_token}`,
191190
},
192-
data: stream,
191+
data: fh.readableWebStream({ type: "bytes" }),
193192
});
194193
const json = resp.data;
195194
if (resp.status !== 201) {
@@ -202,7 +201,7 @@ export const upload = async (
202201
console.log(`✅ Uploaded ${name}`);
203202
return json;
204203
} finally {
205-
await fh.close().catch(() => {});
204+
await fh.close();
206205
}
207206
};
208207

src/util.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ const parseMakeLatest = (
9191
export const paths = (patterns: string[]): string[] => {
9292
return patterns.reduce((acc: string[], pattern: string): string[] => {
9393
return acc.concat(
94-
glob
95-
.sync(pattern)
96-
.filter((path) => statSync(path).isFile())
97-
.map((path) => path.replace(/\\/g, "/")),
94+
glob.sync(pattern).filter((path) => statSync(path).isFile()),
9895
);
9996
}, []);
10097
};

0 commit comments

Comments
 (0)