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

fix: default to .cjs extension in config files

This commit is contained in:
wagoid 2021-07-15 15:50:37 -03:00
parent 0dd6697d4c
commit 5b6cd1b23a
5 changed files with 11 additions and 9 deletions

View file

@ -1,5 +1,5 @@
node_modules node_modules
commitlint.config.js commitlint.config.cjs
action.yml action.yml
.github .github
CHANGELOG.md CHANGELOG.md

View file

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. See [standa
* Node.js version used on the action updated from 12 to * Node.js version used on the action updated from 12 to
16 16
* Config files now need to be renamed from .js to .cjs
### Features ### Features

View file

@ -32,7 +32,7 @@ You can supply these inputs to the `wagoid/commitlint-github-action@v3` step.
The path to your commitlint config file. The path to your commitlint config file.
Default: `commitlint.config.js` Default: `commitlint.config.cjs`
If the config file doesn't exist, [config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) settings will be loaded as a default fallback. If the config file doesn't exist, [config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) settings will be loaded as a default fallback.

View file

@ -3,19 +3,20 @@ description: Lints Pull Request commit messages with commitlint
author: Wagner Santos author: Wagner Santos
inputs: inputs:
configFile: configFile:
description: Commitlint config file. If the file doesn't exist, config-conventional settings will be description:
Commitlint config file. If the file doesn't exist, config-conventional settings will be
loaded as a fallback. loaded as a fallback.
default: ./commitlint.config.js default: ./commitlint.config.cjs
required: false required: false
firstParent: firstParent:
description: > description: >
When set to true, we follow only the first parent commit when seeing a merge commit. More info When set to true, we follow only the first parent commit when seeing a merge commit. More info
in git-log docs https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent in git-log docs https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent
default: "true" default: 'true'
required: false required: false
failOnWarnings: failOnWarnings:
description: Whether you want to fail on warnings or not description: Whether you want to fail on warnings or not
default: "false" default: 'false'
required: false required: false
helpURL: helpURL:
description: Link to a page explaining your commit message convention description: Link to a page explaining your commit message convention

View file

@ -48,7 +48,7 @@ describe('Commit Linter action', () => {
td.replace(core, 'getInput') td.replace(core, 'getInput')
td.replace(core, 'setFailed') td.replace(core, 'setFailed')
td.replace(core, 'setOutput') td.replace(core, 'setOutput')
td.when(core.getInput('configFile')).thenReturn('./commitlint.config.js') td.when(core.getInput('configFile')).thenReturn('./commitlint.config.cjs')
td.when(core.getInput('firstParent')).thenReturn('true') td.when(core.getInput('firstParent')).thenReturn('true')
td.when(core.getInput('failOnWarnings')).thenReturn('false') td.when(core.getInput('failOnWarnings')).thenReturn('false')
td.when(core.getInput('helpURL')).thenReturn( td.when(core.getInput('helpURL')).thenReturn(
@ -273,7 +273,7 @@ describe('Commit Linter action', () => {
beforeEach(async () => { beforeEach(async () => {
cwd = await git.bootstrap('fixtures/conventional') cwd = await git.bootstrap('fixtures/conventional')
td.when(core.getInput('configFile')).thenReturn( td.when(core.getInput('configFile')).thenReturn(
'./commitlint.config.js', './commitlint.config.cjs',
) )
await gitEmptyCommit(cwd, 'message from before push') await gitEmptyCommit(cwd, 'message from before push')
await gitEmptyCommit(cwd, firstMessage) await gitEmptyCommit(cwd, firstMessage)
@ -341,7 +341,7 @@ describe('Commit Linter action', () => {
describe('when it fails to fetch commits', () => { describe('when it fails to fetch commits', () => {
beforeEach(async () => { beforeEach(async () => {
cwd = await git.bootstrap('fixtures/conventional') cwd = await git.bootstrap('fixtures/conventional')
td.when(core.getInput('configFile')).thenReturn('./commitlint.config.js') td.when(core.getInput('configFile')).thenReturn('./commitlint.config.cjs')
await gitEmptyCommit(cwd, 'commit message') await gitEmptyCommit(cwd, 'commit message')
await createPullRequestEventPayload(cwd) await createPullRequestEventPayload(cwd)
const [to] = await getCommitHashes(cwd) const [to] = await getCommitHashes(cwd)