mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 16:06:56 +00:00
feat: use config-conventional as default config
This commit is contained in:
parent
f58503be31
commit
7e678913ff
2 changed files with 15 additions and 2 deletions
|
|
@ -120,11 +120,10 @@ const handleOnlyWarnings = formattedResults => {
|
|||
}
|
||||
|
||||
const showLintResults = async ([from, to]) => {
|
||||
const failOnWarnings = core.getInput('failOnWarnings')
|
||||
const commits = await getHistoryCommits(from, to)
|
||||
const config = existsSync(configPath)
|
||||
? await load({}, { file: configPath })
|
||||
: {}
|
||||
: await load({ extends: ['@commitlint/config-conventional'] })
|
||||
const opts = getOptsFromConfig(config)
|
||||
const lintedCommits = await Promise.all(
|
||||
commits.map(async commit => ({
|
||||
|
|
|
|||
|
|
@ -60,6 +60,20 @@ describe('Commit Linter action', () => {
|
|||
jest.resetModules()
|
||||
})
|
||||
|
||||
it('should use default config when config file does not exist', async () => {
|
||||
td.when(core.getInput('configFile')).thenReturn('./not-existing-config.js')
|
||||
cwd = await git.bootstrap('fixtures/conventional')
|
||||
await gitEmptyCommit(cwd, 'wrong message')
|
||||
const [to] = await getCommitHashes(cwd)
|
||||
await createPushEventPayload(cwd, { to })
|
||||
updatePushEnvVars(cwd, to)
|
||||
td.replace(process, 'cwd', () => cwd)
|
||||
|
||||
await runAction()
|
||||
|
||||
td.verify(core.setFailed(contains('You have commit messages with errors')))
|
||||
})
|
||||
|
||||
it('should fail for single push with incorrect message', async () => {
|
||||
cwd = await git.bootstrap('fixtures/conventional')
|
||||
await gitEmptyCommit(cwd, 'wrong message')
|
||||
|
|
|
|||
Loading…
Reference in a new issue