From c9446142eabe28e24f7e07ee2351c47934fca2e5 Mon Sep 17 00:00:00 2001 From: netanelC Date: Tue, 17 Dec 2024 22:01:33 +0200 Subject: [PATCH 1/2] feat: add pr-title workflow --- .github/workflows/commitlint-pr-title.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/commitlint-pr-title.yaml diff --git a/.github/workflows/commitlint-pr-title.yaml b/.github/workflows/commitlint-pr-title.yaml new file mode 100644 index 00000000..e3608897 --- /dev/null +++ b/.github/workflows/commitlint-pr-title.yaml @@ -0,0 +1,30 @@ +name: Lint PR Title + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + pr-title-lint: + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + + - name: Install Commitlint + run: | + npm install @commitlint/{config-conventional,cli} + + - name: Lint PR Title + run: | + # Extract the PR title + pr_title=$(echo "${{ github.event.pull_request.title }}") + # Validate the PR title using commitlint + echo "$pr_title" | npx commitlint --config commitlint.config.mjs From 5d89837760ae012a6f17b64003eb9aea75abf164 Mon Sep 17 00:00:00 2001 From: netanelC Date: Wed, 18 Dec 2024 11:45:45 +0200 Subject: [PATCH 2/2] feat: add commitlint --- commitlint.config.mjs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 commitlint.config.mjs diff --git a/commitlint.config.mjs b/commitlint.config.mjs new file mode 100644 index 00000000..6de0ec45 --- /dev/null +++ b/commitlint.config.mjs @@ -0,0 +1,20 @@ +export default { + extends: ["@commitlint/config-conventional"], + rules: { + "scope-empty": [1, "never"], + "scope-enum": [ + 2, + "always", + [ + "repo", + "commitlint", + "pull-request", + "npm-publish", + "push-docker", + "push-helm", + "update-artifacts", + ], + ], + "header-min-length": [2, "always", 10], + }, +};