5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 16:06:56 +00:00

fix: action failing to check footer of a single commit

Fixes #187
This commit is contained in:
wagoid 2021-09-11 08:22:56 -03:00
parent 0e361e0644
commit 961b6d4cd7
3 changed files with 11 additions and 4 deletions

View file

@ -0,0 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'signed-off-by': [2, 'always', 'Signed-off-by:'],
},
}

View file

@ -1,5 +1,6 @@
/* eslint-env jest */ /* eslint-env jest */
import { git } from '@commitlint/test' import { git } from '@commitlint/test'
import { describe } from '@jest/globals'
import execa from 'execa' import execa from 'execa'
import td from 'testdouble' import td from 'testdouble'
import { import {
@ -555,12 +556,12 @@ describe('Commit Linter action', () => {
}) })
}) })
describe('when commit contains signed-off-by message', () => { describe('when commit contains required signed-off-by message', () => {
beforeEach(async () => { beforeEach(async () => {
cwd = await git.bootstrap('fixtures/conventional') cwd = await git.bootstrap('fixtures/signed-off-by')
await gitEmptyCommit( await gitEmptyCommit(
cwd, cwd,
'chore: correct message\n\nsome context without leading blank line\nSigned-off-by: John Doe <john.doe@example.com>', 'chore: correct message\n\nsome context without leading blank line.\n\nSigned-off-by: John Doe <john.doe@example.com>',
) )
const [to] = await getCommitHashes(cwd) const [to] = await getCommitHashes(cwd)
await createPushEventPayload(cwd, { to }) await createPushEventPayload(cwd, { to })

View file

@ -33,7 +33,7 @@ const gitCommits = async (gitOpts) => {
return { return {
hash, hash,
message, message: message.replace(commitDelimiter, ''),
} }
}) })