Skip to content

Commit

Permalink
Added new input allow_missing_changelog:boolean (#23)
Browse files Browse the repository at this point in the history
- Added new input `allow_missing_changelog: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.
  • Loading branch information
lmajano authored Mar 22, 2023
1 parent 0a3a16a commit 34d3d3b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
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 `allow_missing_changelog: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 | |
| allow_missing_changelog | 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
allow_missing_changelog:
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 allow_missing_changelog is true then default to empty value if version not found
if [[ "${INPUT_ALLOW_MISSING_CHANGELOG}" == "true" ]]; then
notes=$(./parse-changelog "${parse_changelog_options[@]}" || echo "")
else
notes=$(./parse-changelog "${parse_changelog_options[@]}")
fi

rm -f ./parse-changelog
fi

Expand Down

0 comments on commit 34d3d3b

Please sign in to comment.