Compare commits
7 Commits
debug
...
debug-cros
Author | SHA1 | Date | |
---|---|---|---|
e6268c631a | |||
8988630456 | |||
c1b107442c | |||
4c8c431191 | |||
1505034bb0 | |||
21e9098c3b | |||
26941a6e6b |
@ -1,6 +1,3 @@
|
||||
## 0.1.11
|
||||
|
||||
- better error message on release create failed [#143](https://github.com/softprops/action-gh-release/pull/143)
|
||||
## 0.1.10
|
||||
|
||||
- fixed error message formatting for file uploads
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "action-gh-release",
|
||||
"version": "0.1.11",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"description": "GitHub Action for creating GitHub Releases",
|
||||
"main": "lib/main.js",
|
||||
|
@ -124,7 +124,7 @@ export const asset = (path: string): ReleaseAsset => {
|
||||
name: basename(path),
|
||||
mime: mimeOrDefault(path),
|
||||
size: lstatSync(path).size,
|
||||
data: readFileSync(path),
|
||||
data: readFileSync(path)
|
||||
};
|
||||
};
|
||||
|
||||
@ -149,7 +149,7 @@ export const upload = async (
|
||||
await github.rest.repos.deleteReleaseAsset({
|
||||
asset_id: currentAsset.id || 1,
|
||||
owner,
|
||||
repo,
|
||||
repo
|
||||
});
|
||||
}
|
||||
console.log(`⬆️ Uploading ${name}...`);
|
||||
@ -159,10 +159,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) {
|
||||
@ -199,21 +199,19 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`fetching existing release for tag ${owner}/${repo}/${tag}`);
|
||||
let existingRelease = await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag,
|
||||
tag
|
||||
});
|
||||
console.log(`found release ${existingRelease.data.id}`);
|
||||
|
||||
const release_id = existingRelease.data.id;
|
||||
let target_commitish: string;
|
||||
@ -247,21 +245,6 @@ export const release = async (
|
||||
? config.input_prerelease
|
||||
: existingRelease.data.prerelease;
|
||||
|
||||
console.log(
|
||||
`attemping update of release_id ${release_id} tag_name ${tag_name} target_commitish ${target_commitish} discussion_category_name ${discussion_category_name}`
|
||||
);
|
||||
console.log({
|
||||
owner,
|
||||
repo,
|
||||
release_id,
|
||||
tag_name,
|
||||
target_commitish,
|
||||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
discussion_category_name,
|
||||
});
|
||||
const release = await releaser.updateRelease({
|
||||
owner,
|
||||
repo,
|
||||
@ -272,14 +255,11 @@ export const release = async (
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
discussion_category_name,
|
||||
discussion_category_name
|
||||
});
|
||||
console.log(`updated release ${release_id}`);
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
console.log(`update failed with 404`);
|
||||
console.log(JSON.stringify(error.response.data.errors));
|
||||
const tag_name = tag;
|
||||
const name = config.input_name || tag;
|
||||
const body = releaseBody(config);
|
||||
@ -291,20 +271,8 @@ export const release = async (
|
||||
commitMessage = ` using commit "${target_commitish}"`;
|
||||
}
|
||||
console.log(
|
||||
`👩🏭 Creating new GitHub release for tag ${tag_name}${commitMessage}...`
|
||||
`👩🏭 Creating new GitHub release in ${owner}/${repo} for tag ${tag_name}${commitMessage}...`
|
||||
);
|
||||
|
||||
console.log({
|
||||
owner,
|
||||
repo,
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish,
|
||||
discussion_category_name,
|
||||
});
|
||||
try {
|
||||
let release = await releaser.createRelease({
|
||||
owner,
|
||||
@ -315,7 +283,7 @@ export const release = async (
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish,
|
||||
discussion_category_name,
|
||||
discussion_category_name
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
13
src/util.ts
13
src/util.ts
@ -42,8 +42,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()),
|
||||
[]
|
||||
);
|
||||
};
|
||||
@ -63,16 +63,15 @@ export const parseConfig = (env: Env): Config => {
|
||||
? env.INPUT_PRERELEASE == "true"
|
||||
: undefined,
|
||||
input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH || undefined,
|
||||
input_discussion_category_name:
|
||||
env.INPUT_DISCUSSION_CATEGORY_NAME || undefined,
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH,
|
||||
input_discussion_category_name: env.INPUT_DISCUSSION_CATEGORY_NAME
|
||||
};
|
||||
};
|
||||
|
||||
export const paths = (patterns: string[]): string[] => {
|
||||
return patterns.reduce((acc: string[], pattern: string): string[] => {
|
||||
return acc.concat(
|
||||
glob.sync(pattern).filter((path) => lstatSync(path).isFile())
|
||||
glob.sync(pattern).filter(path => lstatSync(path).isFile())
|
||||
);
|
||||
}, []);
|
||||
};
|
||||
@ -80,7 +79,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) => lstatSync(path).isFile()).length == 0
|
||||
glob.sync(pattern).filter(path => lstatSync(path).isFile()).length == 0
|
||||
? [pattern]
|
||||
: []
|
||||
);
|
||||
|
Reference in New Issue
Block a user