Skip to content

Commit e0c8746

Browse files
committed
fix: use helpUrl from config when present
Fixes #234
1 parent 6e7e70a commit e0c8746

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
helpUrl: 'https://example.org',
4+
}

src/action.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ describe('Commit Linter action', () => {
7676
await runAction()
7777

7878
td.verify(core.setFailed(contains('You have commit messages with errors')))
79+
td.verify(
80+
core.setFailed(
81+
contains(
82+
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
83+
),
84+
),
85+
)
7986
})
8087

8188
it('should fail for single push with incorrect message', async () => {
@@ -577,4 +584,25 @@ describe('Commit Linter action', () => {
577584
td.verify(console.log('Lint free! 🎉'))
578585
})
579586
})
587+
588+
describe('when a different helpUrl is provided in the config', () => {
589+
beforeEach(async () => {
590+
cwd = await git.bootstrap('fixtures/custom-help-url')
591+
await gitEmptyCommit(cwd, 'wrong message')
592+
const [to] = await getCommitHashes(cwd)
593+
await createPushEventPayload(cwd, { to })
594+
updatePushEnvVars(cwd, to)
595+
td.replace(process, 'cwd', () => cwd)
596+
td.replace(console, 'log')
597+
})
598+
599+
it('should show custom URL from helpUrl', async () => {
600+
await runAction()
601+
602+
td.verify(
603+
core.setFailed(contains('You have commit messages with errors')),
604+
)
605+
td.verify(core.setFailed(contains(' https://example.org')))
606+
})
607+
})
580608
})

0 commit comments

Comments
 (0)