diff --git a/.github/workflows/conventional-pr.yml b/.github/workflows/conventional-pr.yml new file mode 100644 index 0000000..7564909 --- /dev/null +++ b/.github/workflows/conventional-pr.yml @@ -0,0 +1,31 @@ +name: "Lint PR title" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + branches: + - 'main' +permissions: + contents: read + pull-requests: read + +jobs: + lint: + if: ${{ github.head_ref != 'develop' }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install dependencies + run: npm install @commitlint/cli @commitlint/config-conventional + + - name: Validate PR title + run: | + PR_TITLE=$(jq -r '.pull_request.title' "$GITHUB_EVENT_PATH") + echo "$PR_TITLE" | npx commitlint --config commitlint.config.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..c3481a7 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "semi": false +} \ No newline at end of file diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..4fedde6 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] }