Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.mjs
action.yml
.github
CHANGELOG.md
Expand Down
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
"node/no-unpublished-require": "off",
"node/no-unpublished-import": "off",
"node/no-unsupported-features/es-syntax": "off"
}
},
"ignorePatterns": [
".github/tasks/actionYamlUpdater.js",
"rollup.config.js",
"fixtures"
]
}
4 changes: 2 additions & 2 deletions .github/tasks/actionYamlUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const yaml = require('yaml')

const versionRegex = /\d+\.\d+\.\d+/

module.exports.readVersion = (contents) =>
exports.readVersion = (contents) =>
yaml.parse(contents).runs.image.match(versionRegex)[0]

module.exports.writeVersion = (contents, version) => {
exports.writeVersion = (contents, version) => {
const actionFile = yaml.parse(contents)
actionFile.runs.image = actionFile.runs.image.replace(versionRegex, version)

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ jobs:
git config user.email '[email protected]'
git config user.name 'GitHub Action'
- name: Update versions and changelog
run: npx commit-and-tag-version
run: |
# remove `"type": "module"` from package.json since `commit-and-tag-version` doesn't support it
sed -i '/"type": "module",/c\' package.json
npx commit-and-tag-version
# bring back `"type": "module"`
sed -i 's/"private": true,/"private": true,\n "type": "module",/' package.json
git commit --amend --no-edit
- name: Set VERSION env var
run: |
version=`node -p "require('./package.json').version"`
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.js → .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
'*.{ts,tsx,vue,css,less,scss,html,htm,md,markdown}': 'prettier --write',
'*.{json,yml,yaml}': ['prettier --write', () => 'npm run test'],
'*.{js,jsx}': ['eslint --fix', () => 'npm run test'],
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.2-alpine3.14 as build
FROM node:20.9.0-alpine3.17 as build

COPY package*.json /

Expand All @@ -12,7 +12,7 @@ FROM node:20.9.0-alpine3.17

RUN apk --no-cache add git

COPY --from=build dist/run.js /run.js
COPY --from=build dist/run.mjs /run.mjs

COPY package*.json /

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v5
- uses: wagoid/commitlint-github-action@v6
```

Alternatively, you can run on other event types such as `on: [push]`. In that case the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine `push` and `pull_request` together in the same workflow.

## Inputs

You can supply these inputs to the `wagoid/commitlint-github-action@v5` step.
You can supply these inputs to the `wagoid/commitlint-github-action@v6` step.

### `configFile`

The path to your commitlint config file.

Default: `commitlint.config.js`
Default: `commitlint.config.mjs`

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.

Details on the configuration file can be found on [the commitlint website](https://commitlint.js.org/#/reference-configuration).

Note: `commitlint.config.js` doesn't work with this action. If you use a JS config file, it's required to be an ES Module (`.mjs` extension)

### `failOnWarnings`

Whether you want to fail on warnings or not.
Expand Down Expand Up @@ -149,7 +151,7 @@ jobs:
- run: npm install
# Run the commitlint action, considering its own dependencies and yours as well 🚀
# `github.workspace` is the path to your repository.
- uses: wagoid/commitlint-github-action@v5
- uses: wagoid/commitlint-github-action@v6
env:
NODE_PATH: ${{ github.workspace }}/node_modules
```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
configFile:
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.mjs
required: false
failOnWarnings:
description: Whether you want to fail on warnings or not
Expand Down
4 changes: 2 additions & 2 deletions commitlint.config.js → commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
const { maxLineLength } = require('@commitlint/ensure')
import { maxLineLength } from '@commitlint/ensure'

const bodyMaxLineLength = 100

Expand All @@ -14,7 +14,7 @@ const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
]
}

module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
Expand Down
6 changes: 4 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ set -e
if [ -z "$NODE_PATH" ]; then
export NODE_PATH=/node_modules
else
export NODE_PATH=$NODE_PATH:/node_modules
export NODE_PATH="$NODE_PATH":/node_modules
fi

# Since actions/checkout can be setup with a different user ID, we need to set the workspace as safe inside this action
# Info about the vunlerability: https://github.blog/2022-04-12-git-security-vulnerability-announced/
git config --global --add safe.directory "$GITHUB_WORKSPACE"

node /run.js
export NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules"

node /run.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
helpUrl: 'https://example.org',
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: ['commitlint-plugin-jira-rules'],
extends: ['jira'],
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'signed-off-by': [2, 'always', 'Signed-off-by:'],
Expand Down
8 changes: 5 additions & 3 deletions jest.config.js → jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module.exports = {
export default {
// Automatically clear mock calls and instances between every test
// preset: 'rollup-jest',
clearMocks: true,
testEnvironment: '@commitlint/test-environment',
testMatch: [
'**/__tests__/**/*.?(m)[jt]s?(x)',
'**/?(*.)+(spec|test).?(m)[tj]s?(x)',
],
transform: {
'\\.[jt]sx?$': 'babel-jest',
},
transformIgnorePatterns: ['node_modules/(?!dargs)'],
}
Loading