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

Add input variable to allow overriding release title #45

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

manue1
Copy link
Contributor

@manue1 manue1 commented Sep 27, 2023

In order to be able to provide a custom release title instead of the repository name, this PR introduces a release_title input variable.

@manue1 manue1 requested a review from a team as a code owner September 27, 2023 11:07
@williammartin williammartin requested review from andyfeller and removed request for williammartin September 27, 2023 11:08
Copy link
Contributor

@andyfeller andyfeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manue1 : Thank you for contributing again to the GitHub CLI! ✨

I think these changes are technically straightforward with a minor safeguard suggestion but also a philosophical question on how others would expect this input to behave.

action.yml Outdated
- id: determine_release_title
run: |
if [ -n "$INPUT_TITLE" ]; then
title=$INPUT_TITLE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title=$INPUT_TITLE
title="$INPUT_TITLE"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 3bedb9f.

@@ -72,5 +72,5 @@ if gh release view "$GH_RELEASE_TAG" >/dev/null; then
gh release upload "$GH_RELEASE_TAG" --clobber -- "${assets[@]}"
else
echo "creating release and uploading assets..."
gh release create "$GH_RELEASE_TAG" $prerelease $draft_release --title="${GITHUB_REPOSITORY#*/} ${GH_RELEASE_TAG#v}" --generate-notes -- "${assets[@]}"
gh release create "$GH_RELEASE_TAG" $prerelease $draft_release --title="${GH_RELEASE_TITLE} ${GH_RELEASE_TAG#v}" --generate-notes -- "${assets[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would someone expect full control over the release title if GH_RELEASE_TITLE is set or not?

This is the big question on my mind as build_and_release.sh doesn't use the GH_RELEASE_TITLE as-is but treats this more like a prefix.

If these changes had it such that it was full control over the title, then it means users would need a way to set this such that INPUT_TAG could be used after it has been evaluated above. That's when this starts getting complicated.

Otherwise, should we rename this variable to avoid confusion?

@manue1 : what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I actually missed on the first glance that the title string also included the tag. I have renamed it to title prefix in 38be18e for clarity. Let me know what you think.

Copy link
Contributor

@andyfeller andyfeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit: Thank you again, Manuel!

Comment on lines 32 to 37
if [ -n "$INPUT_TOKEN" ]; then
token=$INPUT_TOKEN
token="$INPUT_TOKEN"
else
token=$DEFAULT_TOKEN
token="$DEFAULT_TOKEN"
fi
echo "TOKEN=$token" >> "$GITHUB_OUTPUT"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning up some of the other code!

This is one of those oft forgotten and annoying shell script isms that https://github.com/koalaman/shellcheck would suss out but always awkward to ask a contributor to clean up our messes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, easy to spot once you're at it but otherwise easy to miss!

@andyfeller andyfeller merged commit b2a64f6 into cli:trunk Sep 27, 2023
Adawntoremember

This comment was marked as spam.

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.

None yet

3 participants