From 5b6cd1b23af3fcd4e6df552d48cc01dff41262dd Mon Sep 17 00:00:00 2001 From: wagoid <7467450+wagoid@users.noreply.github.com> Date: Thu, 15 Jul 2021 15:50:37 -0300 Subject: [PATCH] fix: default to .cjs extension in config files --- .dockerignore | 2 +- CHANGELOG.md | 1 + README.md | 2 +- action.yml | 9 +++++---- src/action.test.js | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index a9c08788..f0d6e231 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ node_modules -commitlint.config.js +commitlint.config.cjs action.yml .github CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e89156ed..49ed4685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index be6f0d23..7e8b5a0f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/action.yml b/action.yml index 3ba3e0c0..64bc5a46 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/src/action.test.js b/src/action.test.js index f2970a82..b18464cb 100644 --- a/src/action.test.js +++ b/src/action.test.js @@ -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( @@ -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) @@ -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)