mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 10:44:19 +00:00
Change existingRelease
to be a Release rather than a Promise
No real changes yet, this is just a small cleanup before the upcoming commits.
This commit is contained in:
parent
d4e8205d7e
commit
bdee2a89b1
2 changed files with 16 additions and 14 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -212,34 +212,36 @@ export const release = async (
|
|||
}
|
||||
}
|
||||
}
|
||||
let existingRelease = await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag,
|
||||
});
|
||||
let existingRelease = (
|
||||
await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag,
|
||||
})
|
||||
).data;
|
||||
|
||||
const release_id = existingRelease.data.id;
|
||||
const release_id = existingRelease.id;
|
||||
let target_commitish: string;
|
||||
if (
|
||||
config.input_target_commitish &&
|
||||
config.input_target_commitish !== existingRelease.data.target_commitish
|
||||
config.input_target_commitish !== existingRelease.target_commitish
|
||||
) {
|
||||
console.log(
|
||||
`Updating commit from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
|
||||
`Updating commit from "${existingRelease.target_commitish}" to "${config.input_target_commitish}"`
|
||||
);
|
||||
target_commitish = config.input_target_commitish;
|
||||
} else {
|
||||
target_commitish = existingRelease.data.target_commitish;
|
||||
target_commitish = existingRelease.target_commitish;
|
||||
}
|
||||
|
||||
const tag_name = tag;
|
||||
const name = config.input_name || existingRelease.data.name || tag;
|
||||
const name = config.input_name || existingRelease.name || tag;
|
||||
// revisit: support a new body-concat-strategy input for accumulating
|
||||
// body parts as a release gets updated. some users will likely want this while
|
||||
// others won't previously this was duplicating content for most which
|
||||
// no one wants
|
||||
const workflowBody = releaseBody(config) || "";
|
||||
const existingReleaseBody = existingRelease.data.body || "";
|
||||
const existingReleaseBody = existingRelease.body || "";
|
||||
let body: string;
|
||||
if (config.input_append_body && workflowBody && existingReleaseBody) {
|
||||
body = existingReleaseBody + "\n" + workflowBody;
|
||||
|
@ -250,11 +252,11 @@ export const release = async (
|
|||
const draft =
|
||||
config.input_draft !== undefined
|
||||
? config.input_draft
|
||||
: existingRelease.data.draft;
|
||||
: existingRelease.draft;
|
||||
const prerelease =
|
||||
config.input_prerelease !== undefined
|
||||
? config.input_prerelease
|
||||
: existingRelease.data.prerelease;
|
||||
: existingRelease.prerelease;
|
||||
|
||||
const release = await releaser.updateRelease({
|
||||
owner,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue