diff --git a/src/commit.ts b/src/commit.ts index bd0d5a800..80e2fbfb8 100644 --- a/src/commit.ts +++ b/src/commit.ts @@ -431,6 +431,7 @@ export function parseConventionalCommits( message: parsedCommit.header, files: commit.files, pullRequest: commit.pullRequest, + author: commit.author, type: parsedCommit.type, scope: parsedCommit.scope, bareMessage: parsedCommit.subject, diff --git a/test/commits.ts b/test/commits.ts index 55ecdeacb..cf720ded2 100644 --- a/test/commits.ts +++ b/test/commits.ts @@ -263,6 +263,21 @@ describe('parseConventionalCommits', () => { expect(commit.type).to.eql('chore'); }); + it('preserves author metadata when parsing commits', async () => { + const commit = buildMockCommit('feat: some feature'); + commit.author = { + name: 'Jane Developer', + email: 'jane@example.com', + username: 'janedev', + }; + const conventionalCommits = parseConventionalCommits([commit]); + expect(conventionalCommits).lengthOf(1); + expect(conventionalCommits[0].author).to.not.be.undefined; + expect(conventionalCommits[0].author!.name).to.equal('Jane Developer'); + expect(conventionalCommits[0].author!.email).to.equal('jane@example.com'); + expect(conventionalCommits[0].author!.username).to.equal('janedev'); + }); + // it('ignores reverted commits', async () => { // const commits = [ // {sha: 'sha1', message: 'feat: some feature', files: ['path1/file1.txt']},