mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-13 19:54:20 +00:00
pass token explicitly
This commit is contained in:
parent
085ff2701b
commit
ea51250dd0
3 changed files with 22 additions and 1936 deletions
1939
dist/index.js
vendored
1939
dist/index.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -128,7 +128,7 @@ export const mimeOrDefault = (path: string): string => {
|
|||
};
|
||||
|
||||
export const upload = async (
|
||||
gh: GitHub,
|
||||
ghToken: string,
|
||||
url: string,
|
||||
path: string
|
||||
): Promise<any> => {
|
||||
|
@ -141,7 +141,7 @@ export const upload = async (
|
|||
headers: {
|
||||
"content-length": `${size}`,
|
||||
"content-type": mime,
|
||||
authorization: `${gh.auth}`
|
||||
authorization: `token ${ghToken}`
|
||||
},
|
||||
method: "POST",
|
||||
body
|
||||
|
@ -150,6 +150,11 @@ export const upload = async (
|
|||
console.log(resp.status);
|
||||
const json = await resp.json();
|
||||
console.log(`body`, json);
|
||||
if (resp.status !== 201) {
|
||||
throw new Error(
|
||||
"failed to upload release asset ${name}. recieved status code ${resp.status}\n${json}"
|
||||
);
|
||||
}
|
||||
return json;
|
||||
|
||||
// return await gh.rest.repos.uploadReleaseAsset({
|
||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -32,10 +32,10 @@ async function run() {
|
|||
}
|
||||
}
|
||||
|
||||
const oktokit = GitHub.plugin(
|
||||
require("@octokit/plugin-throttling"),
|
||||
require("@octokit/plugin-retry")
|
||||
);
|
||||
// const oktokit = GitHub.plugin(
|
||||
// require("@octokit/plugin-throttling"),
|
||||
// require("@octokit/plugin-retry")
|
||||
// );
|
||||
|
||||
const gh = getOctokit(config.github_token, {
|
||||
//new oktokit(
|
||||
|
@ -67,7 +67,7 @@ async function run() {
|
|||
}
|
||||
await Promise.all(
|
||||
files.map(async path => {
|
||||
await upload(gh, uploadUrl(rel.upload_url), path);
|
||||
await upload(config.github_token, uploadUrl(rel.upload_url), path);
|
||||
})
|
||||
).catch(error => {
|
||||
throw error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue