danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.28k stars 368 forks source link

Parse entire commit message not only first line #977

Open fuhlig opened 4 years ago

fuhlig commented 4 years ago

Commit-Messages via danger.git.commits return only the first line and is parsed

What I am trying to achieve are warnings based on file changes in combination with commit guidelines (e.g. breaking changes with conventional commits).

message:

test!: breaking change

- this is the commit body with different "%&&%"§!_" signs

BREAKING-CHANGE:
here are breaking changes. what kind of actions are required?

danger returns:

message: 'test-breaking-change'

I guess is how the message is processed (locally?) https://github.com/danger/danger-js/blob/4100842c8922fa46e975ed772c1eb6ece677ff7e/source/platforms/git/localGetCommits.ts#L17

orta commented 4 years ago

That part of the codebase is only used in danger local, for a normal danger ci or danger pr it would use the GitHub API: https://github.com/danger/danger-js/blob/4100842c8922fa46e975ed772c1eb6ece677ff7e/source/platforms/github/GitHubGit.ts#L19-L29 which comes from https://github.com/danger/danger-js/blob/4100842c8922fa46e975ed772c1eb6ece677ff7e/source/platforms/github/GitHubAPI.ts#L208-L212

A commit looks like this which doesn't seem too have anything a bit more raw for a full message?

fuhlig commented 4 years ago

Is this consistent across all VCS?

I don't quite understand why a local commit is handled differently. Is there any difference between local and remote (on any VCS) commits? Honest question because that would be new to me

orta commented 4 years ago

Everything in the Danger DSL is normally done via an API, with the exception of danger local which replicates one locally. Danger is built to not just run on CI, so no guarantees of FS access.

Each VCS API (github/gitlab/bitbucket etc) all implements their own Commit API -> GitCommit code