Repository navigation
feat: HNAP session reuse + CM1200 timeout fix #322
Workflow file for this run
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 Message Validation | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| jobs: | |
| commitlint: | |
| name: Validate Commit Messages | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| - name: Install commitlint | |
| run: | | |
| npm install --save-dev @commitlint/cli @commitlint/config-conventional | |
| - name: Create commitlint config | |
| run: | | |
| cat > commitlint.config.js << 'EOF' | |
| module.exports = { | |
| extends: ['@commitlint/config-conventional'], | |
| rules: { | |
| 'type-enum': [ | |
| 2, | |
| 'always', | |
| [ | |
| 'feat', // New feature | |
| 'fix', // Bug fix | |
| 'docs', // Documentation changes | |
| 'style', // Code style changes (formatting, missing semi-colons, etc) | |
| 'refactor', // Code refactoring | |
| 'perf', // Performance improvements | |
| 'test', // Adding or updating tests | |
| 'build', // Build system changes | |
| 'ci', // CI/CD changes | |
| 'chore', // Other changes that don't modify src or test files | |
| 'revert', // Revert a previous commit | |
| 'deps', // Dependency updates | |
| ], | |
| ], | |
| 'subject-case': [0], // Allow any case for subject | |
| 'body-max-line-length': [0], // Disable body line length check | |
| }, | |
| }; | |
| EOF | |
| - name: Validate PR commits | |
| run: | | |
| # Get the list of commits in this PR | |
| git fetch origin ${{ github.base_ref }} | |
| # Validate each commit message | |
| npx commitlint --from origin/${{ github.base_ref }} --to HEAD --verbose | |
| - name: Comment on PR (if validation fails) | |
| if: failure() | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const message = `## ❌ Commit Message Validation Failed | |
| Your commit messages don't follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. | |
| ### Expected Format: | |
| \`\`\` | |
| <type>(<optional scope>): <description> | |
| [optional body] | |
| [optional footer] | |
| \`\`\` | |
| ### Valid Types: | |
| - **feat**: A new feature | |
| - **fix**: A bug fix | |
| - **docs**: Documentation changes | |
| - **style**: Code style changes (formatting, missing semi-colons, etc) | |
| - **refactor**: Code refactoring without changing functionality | |
| - **perf**: Performance improvements | |
| - **test**: Adding or updating tests | |
| - **build**: Build system changes | |
| - **ci**: CI/CD configuration changes | |
| - **chore**: Other changes that don't modify src or test files | |
| - **deps**: Dependency updates | |
| ### Examples: | |
| \`\`\` | |
| feat: add support for ARRIS SB8200 modem | |
| fix: resolve authentication timeout on Motorola modems | |
| docs: update installation instructions | |
| refactor: simplify parser discovery logic | |
| test: add tests for TC4400 parser | |
| ci: add CodeQL security scanning | |
| deps: update beautifulsoup4 to 4.12.3 | |
| \`\`\` | |
| ### How to Fix: | |
| 1. Amend your commit messages to follow the format above | |
| 2. Use \`git commit --amend\` for the most recent commit | |
| 3. Use \`git rebase -i\` for older commits | |
| 4. Force push with \`git push --force-with-lease\` | |
| For more details, see the [Contributing Guide](https://github.com/solentlabs/cable_modem_monitor/blob/main/CONTRIBUTING.md).`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: message | |
| }); | |
| - name: Success message | |
| if: success() | |
| run: | | |
| echo "✅ All commit messages are valid!" |