Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
xuthus5 committed Oct 28, 2024
1 parent 10810fb commit 3e80179
Show file tree
Hide file tree
Showing 7 changed files with 4,019 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: Run title checker
uses: ./
with:
pattern: '^(fix|feat|docs|style|refactor|pref|test|build|ci|chore|revert)(\([^)]+\))?(!)?: .{1,50}$'
pattern: '^(fix|feat|docs|style|refactor|pref|test|build|ci|chore|revert)(\([^)]+\))?(!)?: [\x21-\x7E]([\x20-\x7E]{0,48}[\x21-\x7E])?$'
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ This is a GitHub Action to check if Pull Request title or latest commit message

Create a `.github/workflows/common-pr-title-checker.yaml` file in your repository with the following content:

```yaml
name: PR Title Checker

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Common PR Title Checker
uses: xuthus5/pr-title-checker@v0.0.5
```
## Standard
PR titles should follow this format: `<type>(<scope>): <subject>`
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'Common PR Title Checker'
description: 'Check if Pull Request title or latest commit message conform to a specified format'
name: 'PR Title and Commit Message Checker'
description: 'Check PR titles and commit messages against a specified format'
inputs:
pattern:
description: 'Regular expression for validating PR title or latest commit message'
description: 'Regex pattern for validating PR title or commit message'
required: false
default: '^(fix|feat|docs|style|refactor|pref|test|build|ci|chore|revert)(\([^)]+\))?(!)?: .{1,50}$'
default: '^(fix|feat|docs|style|refactor|pref|test|build|ci|chore|revert)(\([^)]+\))?(!)?: [\x21-\x7E]([\x20-\x7E]{0,48}[\x21-\x7E])?$'
runs:
using: 'node20'
main: 'dist/index.js'
Expand Down
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
};
Loading

0 comments on commit 3e80179

Please sign in to comment.