Skip to content

Commit

Permalink
fix: default to .cjs extension in config files
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoid committed Jul 15, 2021
1 parent 0dd6697 commit 5b6cd1b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
commitlint.config.js
commitlint.config.cjs
action.yml
.github
CHANGELOG.md
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
16
* Config files now need to be renamed from .js to .cjs

### Features

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You can supply these inputs to the `wagoid/commitlint-github-action@v3` step.

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.

Expand Down
9 changes: 5 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ description: Lints Pull Request commit messages with commitlint
author: Wagner Santos
inputs:
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.
default: ./commitlint.config.js
default: ./commitlint.config.cjs
required: false
firstParent:
description: >
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
default: "true"
default: 'true'
required: false
failOnWarnings:
description: Whether you want to fail on warnings or not
default: "false"
default: 'false'
required: false
helpURL:
description: Link to a page explaining your commit message convention
Expand Down
6 changes: 3 additions & 3 deletions src/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Commit Linter action', () => {
td.replace(core, 'getInput')
td.replace(core, 'setFailed')
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('failOnWarnings')).thenReturn('false')
td.when(core.getInput('helpURL')).thenReturn(
Expand Down Expand Up @@ -273,7 +273,7 @@ describe('Commit Linter action', () => {
beforeEach(async () => {
cwd = await git.bootstrap('fixtures/conventional')
td.when(core.getInput('configFile')).thenReturn(
'./commitlint.config.js',
'./commitlint.config.cjs',
)
await gitEmptyCommit(cwd, 'message from before push')
await gitEmptyCommit(cwd, firstMessage)
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('Commit Linter action', () => {
describe('when it fails to fetch commits', () => {
beforeEach(async () => {
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 createPullRequestEventPayload(cwd)
const [to] = await getCommitHashes(cwd)
Expand Down

0 comments on commit 5b6cd1b

Please sign in to comment.