mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 19:04:20 +00:00
Delete the existing tag if input_move_existing_tag
is set
This commit is contained in:
parent
4c892f4258
commit
0586125ecb
1 changed files with 28 additions and 3 deletions
|
@ -233,9 +233,34 @@ export const release = async (
|
||||||
config.input_target_commitish &&
|
config.input_target_commitish &&
|
||||||
config.input_target_commitish !== existingRelease.data.target_commitish
|
config.input_target_commitish !== existingRelease.data.target_commitish
|
||||||
) {
|
) {
|
||||||
console.log(
|
|
||||||
`Updating commit from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
|
if (config.input_move_existing_tag) {
|
||||||
);
|
console.log(
|
||||||
|
`Deleting and recreating tag "${tag}". Moving it from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
await releaser.deleteTag({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
ref: tag,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
`⚠️ Failed to delete tag "${tag}" with status: ${
|
||||||
|
error.status
|
||||||
|
}\n${JSON.stringify(
|
||||||
|
error.response.data.errors
|
||||||
|
)}\nretrying... (${maxRetries - 1} retries remaining)`
|
||||||
|
);
|
||||||
|
return release(config, releaser, maxRetries - 1);
|
||||||
|
}
|
||||||
|
} else if (existingRelease.data.target_commitish != undefined) {
|
||||||
|
console.log(
|
||||||
|
`⚠️ Release tag "${tag}" already points at "${existingRelease.data.target_commitish}"; will not update the tag to point at target_commitish "${config.input_target_commitish}". \
|
||||||
|
Set move_existing_tag to true if you want to delete and recreate the "${tag}" existing tag at the new target_commitish.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
target_commitish = config.input_target_commitish;
|
target_commitish = config.input_target_commitish;
|
||||||
} else {
|
} else {
|
||||||
target_commitish = existingRelease.data.target_commitish;
|
target_commitish = existingRelease.data.target_commitish;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue