mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 14:16:02 +00:00
Resolve conflicts
This commit is contained in:
parent
5de29c20f3
commit
95c236c0ce
6 changed files with 8643 additions and 1755 deletions
|
@ -128,7 +128,7 @@ export const asset = (path: string): ReleaseAsset => {
|
|||
name: basename(path),
|
||||
mime: mimeOrDefault(path),
|
||||
size: statSync(path).size,
|
||||
data: readFileSync(path)
|
||||
data: readFileSync(path),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -153,7 +153,7 @@ export const upload = async (
|
|||
await github.rest.repos.deleteReleaseAsset({
|
||||
asset_id: currentAsset.id || 1,
|
||||
owner,
|
||||
repo
|
||||
repo,
|
||||
});
|
||||
}
|
||||
console.log(`⬆️ Uploading ${name}...`);
|
||||
|
@ -163,10 +163,10 @@ export const upload = async (
|
|||
headers: {
|
||||
"content-length": `${size}`,
|
||||
"content-type": mime,
|
||||
authorization: `token ${config.github_token}`
|
||||
authorization: `token ${config.github_token}`,
|
||||
},
|
||||
method: "POST",
|
||||
body
|
||||
body,
|
||||
});
|
||||
const json = await resp.json();
|
||||
if (resp.status !== 201) {
|
||||
|
@ -204,9 +204,9 @@ export const release = async (
|
|||
if (config.input_draft) {
|
||||
for await (const response of releaser.allReleases({
|
||||
owner,
|
||||
repo
|
||||
repo,
|
||||
})) {
|
||||
let release = response.data.find(release => release.tag_name === tag);
|
||||
let release = response.data.find((release) => release.tag_name === tag);
|
||||
if (release) {
|
||||
return release;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ export const release = async (
|
|||
let existingRelease = await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag
|
||||
tag,
|
||||
});
|
||||
|
||||
const release_id = existingRelease.data.id;
|
||||
|
@ -267,7 +267,7 @@ export const release = async (
|
|||
draft,
|
||||
prerelease,
|
||||
discussion_category_name,
|
||||
generate_release_notes
|
||||
generate_release_notes,
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
@ -296,7 +296,7 @@ export const release = async (
|
|||
prerelease,
|
||||
target_commitish,
|
||||
discussion_category_name,
|
||||
generate_release_notes
|
||||
generate_release_notes,
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
@ -304,9 +304,9 @@ export const release = async (
|
|||
console.log(
|
||||
`⚠️ GitHub release failed with status: ${
|
||||
error.status
|
||||
}\n${JSON.stringify(
|
||||
error.response.data.errors
|
||||
)}\nretrying... (${maxRetries - 1} retries remaining)`
|
||||
}\n${JSON.stringify(error.response.data.errors)}\nretrying... (${
|
||||
maxRetries - 1
|
||||
} retries remaining)`
|
||||
);
|
||||
return release(config, releaser, maxRetries - 1);
|
||||
}
|
||||
|
|
12
src/main.ts
12
src/main.ts
|
@ -3,7 +3,7 @@ import {
|
|||
parseConfig,
|
||||
isTag,
|
||||
unmatchedPatterns,
|
||||
uploadUrl
|
||||
uploadUrl,
|
||||
} from "./util";
|
||||
import { release, upload, GitHubReleaser } from "./github";
|
||||
import { getOctokit } from "@actions/github";
|
||||
|
@ -24,7 +24,7 @@ async function run() {
|
|||
}
|
||||
if (config.input_files) {
|
||||
const patterns = unmatchedPatterns(config.input_files);
|
||||
patterns.forEach(pattern =>
|
||||
patterns.forEach((pattern) =>
|
||||
console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
|
||||
);
|
||||
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
|
||||
|
@ -55,8 +55,8 @@ async function run() {
|
|||
console.warn(
|
||||
`Abuse detected for request ${options.method} ${options.url}`
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
//);
|
||||
const rel = await release(config, new GitHubReleaser(gh));
|
||||
|
@ -67,7 +67,7 @@ async function run() {
|
|||
}
|
||||
const currentAssets = rel.assets;
|
||||
const assets = await Promise.all(
|
||||
files.map(async path => {
|
||||
files.map(async (path) => {
|
||||
const json = await upload(
|
||||
config,
|
||||
gh,
|
||||
|
@ -78,7 +78,7 @@ async function run() {
|
|||
delete json.uploader;
|
||||
return json;
|
||||
})
|
||||
).catch(error => {
|
||||
).catch((error) => {
|
||||
throw error;
|
||||
});
|
||||
setOutput("assets", assets);
|
||||
|
|
10
src/util.ts
10
src/util.ts
|
@ -44,8 +44,8 @@ export const parseInputFiles = (files: string): string[] => {
|
|||
(acc, line) =>
|
||||
acc
|
||||
.concat(line.split(","))
|
||||
.filter(pat => pat)
|
||||
.map(pat => pat.trim()),
|
||||
.filter((pat) => pat)
|
||||
.map((pat) => pat.trim()),
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
@ -69,14 +69,14 @@ export const parseConfig = (env: Env): Config => {
|
|||
input_discussion_category_name:
|
||||
env.INPUT_DISCUSSION_CATEGORY_NAME || undefined,
|
||||
input_generate_release_notes: env.INPUT_GENERATE_RELEASE_NOTES == "true",
|
||||
input_append_body: env.INPUT_APPEND_BODY == "true"
|
||||
input_append_body: env.INPUT_APPEND_BODY == "true",
|
||||
};
|
||||
};
|
||||
|
||||
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())
|
||||
glob.sync(pattern).filter((path) => statSync(path).isFile())
|
||||
);
|
||||
}, []);
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ export const paths = (patterns: string[]): string[] => {
|
|||
export const unmatchedPatterns = (patterns: string[]): string[] => {
|
||||
return patterns.reduce((acc: string[], pattern: string): string[] => {
|
||||
return acc.concat(
|
||||
glob.sync(pattern).filter(path => statSync(path).isFile()).length == 0
|
||||
glob.sync(pattern).filter((path) => statSync(path).isFile()).length == 0
|
||||
? [pattern]
|
||||
: []
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue