Dont use node-fetch (#386)
* manually adopt and apply patch from https://github.com/softprops/action-gh-release/issues/206#issuecomment-1325087743 * rebuild --------- Co-authored-by: Doug Tangren <d.tangren@gmail.com>
This commit is contained in:
parent
9e05c79559
commit
1468521d63
4
dist/index.js
vendored
4
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -24,15 +24,13 @@
|
|||||||
"@octokit/plugin-retry": "^4.0.3",
|
"@octokit/plugin-retry": "^4.0.3",
|
||||||
"@octokit/plugin-throttling": "^4.3.2",
|
"@octokit/plugin-throttling": "^4.3.2",
|
||||||
"glob": "^8.0.3",
|
"glob": "^8.0.3",
|
||||||
"mime": "^3.0.0",
|
"mime": "^3.0.0"
|
||||||
"node-fetch": "^2.6.7"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^8.0.0",
|
"@types/glob": "^8.0.0",
|
||||||
"@types/jest": "^29.2.3",
|
"@types/jest": "^29.2.3",
|
||||||
"@types/mime": "^3.0.1",
|
"@types/mime": "^3.0.1",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/node-fetch": "^2.5.12",
|
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"jest": "^29.3.1",
|
"jest": "^29.3.1",
|
||||||
"jest-circus": "^29.3.1",
|
"jest-circus": "^29.3.1",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import fetch from "node-fetch";
|
|
||||||
import { GitHub } from "@actions/github/lib/utils";
|
import { GitHub } from "@actions/github/lib/utils";
|
||||||
import { Config, isTag, releaseBody } from "./util";
|
import { Config, isTag, releaseBody } from "./util";
|
||||||
import { statSync, readFileSync } from "fs";
|
import { statSync, readFileSync } from "fs";
|
||||||
@ -159,16 +158,17 @@ export const upload = async (
|
|||||||
console.log(`⬆️ Uploading ${name}...`);
|
console.log(`⬆️ Uploading ${name}...`);
|
||||||
const endpoint = new URL(url);
|
const endpoint = new URL(url);
|
||||||
endpoint.searchParams.append("name", name);
|
endpoint.searchParams.append("name", name);
|
||||||
const resp = await fetch(endpoint, {
|
const resp = await github.request({
|
||||||
|
method: "POST",
|
||||||
|
url: endpoint.toString(),
|
||||||
headers: {
|
headers: {
|
||||||
"content-length": `${size}`,
|
"content-length": `${size}`,
|
||||||
"content-type": mime,
|
"content-type": mime,
|
||||||
authorization: `token ${config.github_token}`,
|
authorization: `token ${config.github_token}`,
|
||||||
},
|
},
|
||||||
method: "POST",
|
data: body,
|
||||||
body,
|
|
||||||
});
|
});
|
||||||
const json = await resp.json();
|
const json = resp.data;
|
||||||
if (resp.status !== 201) {
|
if (resp.status !== 201) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to upload release asset ${name}. received status code ${
|
`Failed to upload release asset ${name}. received status code ${
|
||||||
|
Loading…
x
Reference in New Issue
Block a user