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

Correctly work when there are no labels #11

Merged
merged 1 commit into from
Nov 10, 2019
Merged

Correctly work when there are no labels #11

merged 1 commit into from
Nov 10, 2019

Conversation

SeanTAllen
Copy link
Member

This fix comes from @jemc.

This script is using set -e so that errors won't go unnoticed.
But when commands are piped together, only the exit status of the
final command matters.

The grep command obviously fails when none of the tags are present
to find, which is causing the script to crash in that case. But it
seems that awk was always returning a success exit status even when
the grep failed, so that explains why we didn't see that issue when
the awk was the final command.

The true command returns success unconditionally and prints nothing.
So, adding || true has the desired effect of explicitly
ignoring/consuming the error from grep, while printing nothing into
the output stream of the subshell, so that the CHANGELOG_TYPES
variable will be an empty string in that case like we want.

Closes #9

This fix comes from @jemc.

This script is using `set -e` so that errors won't go unnoticed.
But when commands are piped together, only the exit status of the
final command matters.

The `grep` command obviously fails when none of the tags are present
to find, which is causing the script to crash in that case. But it
seems that `awk` was always returning a success exit status even when
the `grep` failed, so that explains why we didn't see that issue when
the `awk` was the final command.

The `true` command returns success unconditionally and prints nothing.
So, adding ` || true` has the desired effect of explicitly
ignoring/consuming the error from `grep`, while printing nothing into
the output stream of the subshell, so that the `CHANGELOG_TYPES`
variable will be an empty string in that case like we want.

Closes #9
@SeanTAllen SeanTAllen merged commit e6b4f05 into master Nov 10, 2019
@SeanTAllen SeanTAllen deleted the 9 branch November 10, 2019 15:04
SeanTAllen added a commit that referenced this pull request Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changelog bot extraction of labels fails if no labels
1 participant