danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

Parse entire commit message not only first line

Open fuhlig opened this issue 5 years ago • 3 comments

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

  • no body
  • special chars (like !) are removed

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

fuhlig avatar Jan 24 '20 15:01 fuhlig

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?

orta avatar Jan 24 '20 16:01 orta

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

fuhlig avatar Jan 24 '20 16:01 fuhlig

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

orta avatar Jan 24 '20 17:01 orta