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

fix: commit-lint config to ignore dependable-bot commits #1707

Conversation

the-robot
Copy link
Member

Context

So actually dependable-bot from GitHub does not follow the git conventional commits. The commit-lint will fail when the dependable-bot creates a commit that has more than 100 characters in the commit message body.

We can take a look at this issue on the dependable bot.

Approach

The issue can be solved by updating the commit-lint configuration with a regex that will ignore dependable bot commits.

So one pattern with a dependable bot is that it will start to commit message with Bumps follow by a markdown link [package-name](package-URL). So the regex is created as below to ignore the following pattern.

^Bumps \[(.+)\]\((.+)\)(.*).$

Tests

You can test by creating commits that do not follow conventional git commits.

  1. commit with no prefix (feat:, fix:) -- failure
  2. commit with a message body of more than 100 characters -- failure
  3. commit with a message body of more than 100 characters and following dependable-bot format -- success

@LoneRifle
Copy link
Contributor

Not actually needed - dependabot commits to this repo actually follow conventional commits (see changelog for this repo). Or am I mistaken?

@the-robot
Copy link
Member Author

the-robot commented Sep 27, 2022

We have encountered an issue where the dependable bot upgrade a package, and wrote a description in the commit body, longer than 100 characters. It results in commit-message linting failure.

The error message and commit body content are added for reference.

Body message

Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) and [husky](https://github.com/typicode/husky). These dependencies needed to be updated together.

Updates `semver-regex` from 2.0.0 to 3.1.4
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/compare/v2.0.0...v3.1.4)

Updates `husky` from 4.2.5 to 4.3.8
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.2.5...v4.3.8)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
- dependency-name: husky
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Linting error

✖   body's lines must not be longer than 100 characters [body-max-line-length]

Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

Okay, but that's still not the commit message format that dependabot uses. See eg a8afdcd

Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

Oh, never mind, I just noticed that the regex is a //m. lgtm, hope this works

@the-robot the-robot closed this Sep 28, 2022
@the-robot the-robot reopened this Sep 28, 2022
@LoneRifle LoneRifle merged commit c3987b2 into opengovsg:develop Sep 28, 2022
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

2 participants