From 4ddb25b93165f16749ef7f2847ea1c2118ed6794 Mon Sep 17 00:00:00 2001 From: Aoibhe Wilson Date: Wed, 16 Oct 2024 15:10:38 +0200 Subject: [PATCH] ci(meta): check commit messages with github actions --- .github/workflows/commit.yml | 16 ++++++++++++++++ .prettierrc.json | 8 +++++++- configs/commitlint.config.mjs | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/commit.yml create mode 100644 configs/commitlint.config.mjs diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml new file mode 100644 index 0000000..40a32e4 --- /dev/null +++ b/.github/workflows/commit.yml @@ -0,0 +1,16 @@ +name: Check Commits with CommitLint + +on: + - pull_request + +jobs: + commitlint: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + steps: + - uses: actions/checkout@v3 + - uses: wagoid/commitlint-github-action@v6 + with: + configFile: configs/commitlint.config.mjs diff --git a/.prettierrc.json b/.prettierrc.json index a567fa7..45f779a 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -17,5 +17,11 @@ "useTabs": true, "semi": true, "printWidth": 150, - "requirePragma": false + "requirePragma": false, + "overrides": [ + { + "files": "*.yml", + "options": { "tabWidth": 2 } + } + ] } diff --git a/configs/commitlint.config.mjs b/configs/commitlint.config.mjs new file mode 100644 index 0000000..22aaa9f --- /dev/null +++ b/configs/commitlint.config.mjs @@ -0,0 +1,15 @@ +export default { + /* + * Resolve and load @commitlint/config-conventional from node_modules. + * Referenced packages must be installed + */ + extends: ['@commitlint/config-conventional'], + + /* + * Any rules defined here will override rules from @commitlint/config-conventional + */ + rules: { + 'scope-enum': [2, 'always', ['editor', 'meta', 'runner']], + 'scope-empty': [0, 'never'], + }, +};