chore(deps-dev): bump eslint from 9.39.2 to 10.0.3 in /apps/frontend #114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Commit Lint | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| # Permissions needed to comment on PRs (including dependabot PRs) | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| conventional-commits: | |
| name: Validate Commit Messages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Full history for commit validation | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Install commitlint | |
| run: | | |
| npm install -g @commitlint/cli @commitlint/config-conventional | |
| - name: Validate PR title | |
| run: | | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| echo "$PR_TITLE" | commitlint --config .commitlintrc.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Validate commit messages | |
| run: | | |
| # Get commits in PR | |
| git fetch origin ${{ github.base_ref }} | |
| COMMITS=$(git log origin/${{ github.base_ref }}..HEAD --pretty=format:"%s") | |
| echo "π Validating commits in PR..." | |
| echo "" | |
| # Validate each commit | |
| EXIT_CODE=0 | |
| while IFS= read -r commit; do | |
| echo "Checking: $commit" | |
| if ! echo "$commit" | commitlint --config .commitlintrc.json; then | |
| EXIT_CODE=1 | |
| fi | |
| done <<< "$COMMITS" | |
| if [ $EXIT_CODE -ne 0 ]; then | |
| echo "" | |
| echo "β Some commits don't follow Conventional Commits format!" | |
| echo "" | |
| echo "π Format: <type>(<scope>): <subject>" | |
| echo "" | |
| echo "Examples:" | |
| echo " β feat(devices): add SSDP auto-discovery" | |
| echo " β fix(api): handle null response" | |
| echo " β docs(readme): update installation" | |
| echo "" | |
| echo "Allowed types:" | |
| echo " feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "β All commits follow Conventional Commits format!" | |
| - name: PR comment on failure | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `## β Commit Message Validation Failed | |
| Your PR contains commits that don't follow the [Conventional Commits](https://www.conventionalcommits.org/) format. | |
| ### Required Format | |
| \`\`\` | |
| <type>(<scope>): <subject> | |
| \`\`\` | |
| ### Examples | |
| β \`feat(devices): add SSDP auto-discovery\` | |
| β \`fix(api): handle null response in device sync\` | |
| β \`docs(readme): update installation instructions\` | |
| β \`test(backend): add regression test for XML parsing\` | |
| ### Allowed Types | |
| - \`feat\` - New feature | |
| - \`fix\` - Bug fix | |
| - \`docs\` - Documentation only | |
| - \`style\` - Code style (formatting, no logic change) | |
| - \`refactor\` - Code refactoring (no feature/fix) | |
| - \`perf\` - Performance improvement | |
| - \`test\` - Adding/updating tests | |
| - \`build\` - Build system changes | |
| - \`ci\` - CI/CD changes | |
| - \`chore\` - Maintenance (dependencies, etc.) | |
| - \`revert\` - Revert previous commit | |
| ### Optional Scopes | |
| \`devices\`, \`api\`, \`frontend\`, \`backend\`, \`docker\`, \`workflow\` | |
| ### How to Fix | |
| **Option 1: Amend last commit** | |
| \`\`\`bash | |
| git commit --amend -m "feat(devices): add SSDP discovery" | |
| git push --force-with-lease | |
| \`\`\` | |
| **Option 2: Interactive rebase (multiple commits)** | |
| \`\`\`bash | |
| git rebase -i HEAD~3 # Last 3 commits | |
| # Mark commits as "reword" in editor | |
| # Update commit messages | |
| git push --force-with-lease | |
| \`\`\` | |
| **Need help?** Check [Conventional Commits Guide](https://www.conventionalcommits.org/)` | |
| }) |