mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 06:16:01 +00:00
fix: fix file closing issue (#629)
* fix: handle file closing gracefully * fix: failing test on Windows * format code using npm run fmt
This commit is contained in:
parent
d5382d3e6f
commit
07a2257003
3 changed files with 8 additions and 4 deletions
|
@ -180,6 +180,7 @@ 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(),
|
||||
|
@ -188,7 +189,7 @@ export const upload = async (
|
|||
"content-type": mime,
|
||||
authorization: `token ${config.github_token}`,
|
||||
},
|
||||
data: fh.readableWebStream(),
|
||||
data: stream,
|
||||
});
|
||||
const json = resp.data;
|
||||
if (resp.status !== 201) {
|
||||
|
@ -201,7 +202,7 @@ export const upload = async (
|
|||
console.log(`✅ Uploaded ${name}`);
|
||||
return json;
|
||||
} finally {
|
||||
await fh.close();
|
||||
await fh.close().catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue