question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to lint all commits in a PR?

See original GitHub issue

I’d like to integrate conventional-changelog-lint into my CI process. I can enforce a commit convention on “client side” using Husky as per docs, but how would I enforce the convention on CI?

Assuming that a PR is a list of commits that do not exist on master, then getting those commits is simple:

git log master..$(git symbolic-ref --short HEAD)

I am not sure though whats the best way to feed them to conventional-changelog-lint. Here is what I have ended up with for now:

for sha in $(git --no-pager rev-list master..$(git symbolic-ref --short HEAD)); do git cat-file commit $sha | sed '1,/^$/d' | conventional-changelog-lint; done

The problem with the latter is that it doesn’t exit if either of the validation fails.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gajuscommented, Aug 15, 2016
conventional-changelog-lint --from=HEAD~$(git --no-pager rev-list master..HEAD --count)

another way to do it.

0reactions
marioneblcommented, Apr 8, 2017

I tested

conventional-changelog-lint --from=$TRAVIS_BRANCH --to=$TRAVIS_PULL_REQUEST_BRANCH

with success so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to lint the message of a pull request merge commit?
I've set up a GitHub Actions workflow that uses commitlint to lint messages for all commits of a pull request, but the problem...
Read more >
Squashing Your Pull Requests - Cloud Four
Squash is a Git option to collapse all the incremental commits in your pull request into a single commit. If you use the...
Read more >
Pull Requests - ESLint - Pluggable JavaScript Linter
Create a new branch; Make your changes; Rebase onto upstream; Run the tests; Double check your submission; Push your changes; Submit the pull...
Read more >
Pull Requests | Electron
There is no limit to the number of commits in a pull request. ... Make sure the linter does not report any issues...
Read more >
Submit a Pull Request — tvm 0.11.dev0 documentation
While the lint commands used should be identical to those run in CI, ... python tests/scripts/ci.py lint # Run all lint steps. docker/lint.sh...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found