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

[skip] Add commit length check workflow #79

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

m-czernek
Copy link
Contributor

@m-czernek m-czernek commented Mar 4, 2024

This PR enforces that each commit is <67 characters long, where the first 2 characters are - in the changelog.

If your commit is too long, you can execute git rebase -i HEAD~1 (for the last commit) - change pick to reword, rewrite the commit message, and force push the changes to your branch.

- name: Check Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[^#].{1,65}'
Copy link
Member

Choose a reason for hiding this comment

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

Is this pattern correct? Doesn't it prohibit a # at any of the first 65 characters (which would match something containing (bsc#1234)?

Copy link
Contributor Author

@m-czernek m-czernek Mar 4, 2024

Choose a reason for hiding this comment

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

It does not :) (see this PR). Do you want me to add a long commit that breaks the rule? In either case, we should be able to simplify this to ^.{1,65} I believe, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified the regex - now:

  • A commit over 65 chars will fail, unless it starts with [skip]
  • Any commit that starts with [skip] will pass

@m-czernek m-czernek force-pushed the commit-length-flow branch from 7f915e2 to 45c7855 Compare March 4, 2024 14:52
@m-czernek m-czernek requested a review from agraul March 4, 2024 14:53
Copy link
Member

@meaksh meaksh left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

As discussed in Slack, maybe we should fix https://github.com/openSUSE/obs-service-update_changelog, so multiline commits are not producing too many dashes.

@m-czernek
Copy link
Contributor Author

Agreed @meaksh , I've added it to our backlog: https://github.com/orgs/SUSE/projects/29/views/4?pane=issue&itemId=55548658

Merging this PR in the meantime.

@m-czernek m-czernek merged commit 3bb884a into release/3006.0 Mar 6, 2024
1 check passed
@m-czernek m-czernek deleted the commit-length-flow branch March 6, 2024 12:44
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.

3 participants