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

feat: add 'lowercase-title' option to upgrade action #218

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

rriski
Copy link
Contributor

@rriski rriski commented Jan 19, 2024

Adds 'lowercase-title' option to the 'trunk-action/upgrade' action. Specifying the option converts the PR / commit title "Upgrade trunk" to lowercase, i.e. "upgrade trunk"

Example usage:

  • uses: trunk-io/trunk-action/upgrade@v1 with: prefix: "chore(deps): " lowercase-title: true

This change makes it possible to use the trunk upgrade action in a way that conforms to the commitlint '@commitlint/config-conventional' configuration which specifies that commit message subject must not be sentence-case, start-case, pascal-case, upper-case. With the default commit message title "Upgrade trunk" and prefix: "chore(deps): " the following error is emitted by commitlint using config-conventional:

⧗ input: chore(deps): Upgrade trunk to 1.19.0
✖ subject must not be sentence-case, start-case, pascal-case, upper-case [subject-case]

✖ found 1 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Copy link

@Serpentiel Serpentiel left a comment

Choose a reason for hiding this comment

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

lgtm

@rriski
Copy link
Contributor Author

rriski commented Jan 23, 2024

@TylerJang27 Could you take a look at this?

Copy link
Contributor

@det det left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@TylerJang27
Copy link
Contributor

Hi @rriski! Thanks for the PR! Could you resolve the shellcheck issues seen here and I'll get this landed? You can also repro by running trunk check locally

@rriski
Copy link
Contributor Author

rriski commented Jan 30, 2024

Hi @rriski! Thanks for the PR! Could you resolve the shellcheck issues seen here and I'll get this landed? You can also repro by running trunk check locally

Hi, thanks for taking a look. Sure thing, I have now fixed the stylelint issue. To test the change I have a tmp.sh:

title_message="Upgrade trunk"

if [[ ${LOWERCASE_TITLE} == "true" ]]; then
  title_message=$(echo "${title_message}" | tr '[:upper:]' '[:lower:]')
fi

echo "${title_message}"

and executed it with different options:

❯ LOWERCASE_TITLE=true bash tmp.sh
upgrade trunk
❯ LOWERCASE_TITLE=True bash tmp.sh
Upgrade trunk
❯ LOWERCASE_TITLE=1 bash tmp.sh
Upgrade trunk
❯ LOWERCASE_TITLE=0 bash tmp.sh
Upgrade trunk
❯ LOWERCASE_TITLE=false bash tmp.sh
Upgrade trunk

Adds 'lowercase-title' option to the 'trunk-action/upgrade' action.
Specifying the option converts the PR / commit title "Upgrade trunk"
to lowercase, i.e. "upgrade trunk"

Example usage:

  - uses: trunk-io/trunk-action/upgrade@v1
    with:
      prefix: "chore(deps): "
      lowercase-title: true

This change makes it possible to use the trunk upgrade action in a way
that conforms to the commitlint '@commitlint/config-conventional'
configuration which specifies that commit message subject must not be
sentence-case, start-case, pascal-case, upper-case. With the default
commit message title "Upgrade trunk" and `prefix: "chore(deps): "` the
following error is emitted by commitlint using `config-conventional`:

  ⧗   input: chore(deps): Upgrade trunk to 1.19.0
  ✖   subject must not be sentence-case, start-case, pascal-case, upper-case [subject-case]

  ✖   found 1 problems, 0 warnings
  ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
@TylerJang27 TylerJang27 merged commit 6522858 into trunk-io:main Jan 30, 2024
36 of 38 checks passed
rriski added a commit to aiven/aiven-operator that referenced this pull request Jan 30, 2024
rriski added a commit to aiven/aiven-operator that referenced this pull request Jan 30, 2024
These options are added to get the automated commit to pass commitlint.

Implemented upstream in trunk-io/trunk-action#218
@rriski
Copy link
Contributor Author

rriski commented Jan 30, 2024

Thank you @TylerJang27 for your review and for merging this into main. Could we possibly arrange for a new release to be issued? This would allow us to utilize the new option.

@TylerJang27
Copy link
Contributor

Yep, we'll get this released shortly! @puzzler7

@puzzler7
Copy link
Collaborator

@rriski It's released and the v1 moving tag has been updated to the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants