Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new input allow_missing_changelog:boolean #23

Merged
merged 2 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

### Added

- Added new input `allowMissingChangelog:boolean` that will allow the build to continue to run even though the targeted version was not found on the changelog file. The default of this input is `false` to stay backwards compatible.

## [1.6.3] - 2023-03-19

- Diagnostics improvements.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Currently, changelog format and supported tag names have the following rule:
|-----------|:------------:|-----------------------------------------------------------------------------|---------|---------|
| token | **true** [^1]| GitHub token for creating GitHub Releases (see [action.yml](action.yml) for more) | String | |
| changelog | false | Path to changelog (variables `$tag`, `$version`, `$prefix`, and any string) | String | |
| allowMissingChangelog | false | Allows for the build to continue even if the version is not found in the changelog. The default value of the changelog will be an empty string. | Boolean | `false` |
| title | false | Format of title (variables `$tag`, `$version`, `$prefix`, and any string) | String | `$tag` |
| draft | false | Create a draft release (`true` or `false`) | Boolean | `false` |
| branch | false | Reject releases from commits not contained in branches that match the specified pattern (regular expression) | String | |
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ inputs:
changelog:
description: Path to changelog (variables `$tag`, `$version`, `$prefix`, and any string)
required: false
allowMissingChangelog:
description: >
If true, it will create the GitHub release with an empty notes for the changelog if the changelog.md file does not
have the appropriate version in it. By default, this action will fail if the version tagged is not found in the
changelog file.
required: false
default: false
title:
description: Format of title (variables `$tag`, `$version`, `$prefix`, and any string)
required: false
Expand Down
9 changes: 8 additions & 1 deletion main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ if [[ -n "${changelog}" ]]; then
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://github.com/taiki-e/parse-changelog/releases/download/v${parse_changelog_version}/parse-changelog-${parse_changelog_target}.tar.gz" \
| "${tar}" xzf -
parse_changelog_options+=("${changelog}" "${version}")
notes=$(./parse-changelog "${parse_changelog_options[@]}")

# If allowMissingChangelog is true then default to empty value if version not found
if [[ "${allowMissingChangelog}" == "true" ]]; then
lmajano marked this conversation as resolved.
Show resolved Hide resolved
notes=$(./parse-changelog "${parse_changelog_options[@]}" || echo "")
else
notes=$(./parse-changelog "${parse_changelog_options[@]}")
fi

rm -f ./parse-changelog
fi

Expand Down