mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 14:16:02 +00:00
fix: revert fs:readableWebStream
change (#632)
* Revert "fix: fix file closing issue (#629)"
This reverts commit 07a2257003
.
* fix: revert `fh.readableWebStream` change
Signed-off-by: Rui Chen <rui@chenrui.dev>
---------
Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
parent
f3cad8bcbf
commit
552dc5524b
6 changed files with 14 additions and 22 deletions
|
@ -1,9 +1,9 @@
|
|||
import { GitHub } from "@actions/github/lib/utils";
|
||||
import { Config, isTag, releaseBody, alignAssetName } from "./util";
|
||||
import { statSync } from "fs";
|
||||
import { open } from "fs/promises";
|
||||
import { lookup } from "mime-types";
|
||||
import { basename } from "path";
|
||||
import { alignAssetName, Config, isTag, releaseBody } from "./util";
|
||||
|
||||
type GitHub = InstanceType<typeof GitHub>;
|
||||
|
||||
|
@ -180,7 +180,6 @@ export const upload = async (
|
|||
endpoint.searchParams.append("name", name);
|
||||
const fh = await open(path);
|
||||
try {
|
||||
const stream = fh.readableWebStream();
|
||||
const resp = await github.request({
|
||||
method: "POST",
|
||||
url: endpoint.toString(),
|
||||
|
@ -189,7 +188,7 @@ export const upload = async (
|
|||
"content-type": mime,
|
||||
authorization: `token ${config.github_token}`,
|
||||
},
|
||||
data: stream,
|
||||
data: fh.readableWebStream({ type: "bytes" }),
|
||||
});
|
||||
const json = resp.data;
|
||||
if (resp.status !== 201) {
|
||||
|
@ -202,7 +201,7 @@ export const upload = async (
|
|||
console.log(`✅ Uploaded ${name}`);
|
||||
return json;
|
||||
} finally {
|
||||
await fh.close().catch(() => {});
|
||||
await fh.close();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -91,10 +91,7 @@ const parseMakeLatest = (
|
|||
export const paths = (patterns: string[]): string[] => {
|
||||
return patterns.reduce((acc: string[], pattern: string): string[] => {
|
||||
return acc.concat(
|
||||
glob
|
||||
.sync(pattern)
|
||||
.filter((path) => statSync(path).isFile())
|
||||
.map((path) => path.replace(/\\/g, "/")),
|
||||
glob.sync(pattern).filter((path) => statSync(path).isFile()),
|
||||
);
|
||||
}, []);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue