Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Coverage

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: |
pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile

- name: Run tests with coverage
run: pnpm test:coverage

- name: Generate coverage badge
run: node scripts/generate-coverage-badge.js

- name: Coverage Badge
uses: tj-actions/coverage-badge-js@v1
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
with:
coverage-file: './coverage/coverage-summary.json'

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v12
id: verify-changed-files
with:
files: coverage-badge.json

- name: Create Coverage Badge
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: update coverage badge"
title: "📊 Update Coverage Badge"
body: |
## Coverage Report Update

This PR updates the coverage badge based on the latest test results.

**Coverage Summary:**
- Statements: ${{ env.COVERAGE_STATEMENTS }}%
- Branches: ${{ env.COVERAGE_BRANCHES }}%
- Functions: ${{ env.COVERAGE_FUNCTIONS }}%
- Lines: ${{ env.COVERAGE_LINES }}%

Auto-generated by GitHub Actions.
branch: update-coverage-badge
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ node_modules
.DS_Store
.vscode
keep/*
!keep/README.md
!keep/README.md

# Coverage reports
coverage/
*.lcov

# Generated files
coverage-badge.json
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# create commit
![](https://img.shields.io/badge/node-%5E14-brightgreen.svg)
![Coverage](https://img.shields.io/badge/coverage-83%25-brightgreen)
![Tests](https://img.shields.io/badge/tests-49%20passed-brightgreen)

create commit in human way.

Expand All @@ -20,6 +22,28 @@ bun install -g OwlTing/cz

> Add `export PATH="$(yarn global bin):$PATH"` to your `~./zshrc` if you installed it by yarn global

## Development

### Running Tests
```shell
# Run tests in watch mode
pnpm test

# Run tests once
pnpm test:run

# Run tests with coverage
pnpm test:coverage

# Generate coverage badge
pnpm coverage:badge
```

### Pre-commit Hooks
This project uses [lefthook](https://github.com/evilmartians/lefthook) for pre-commit hooks that automatically run:
- Unit tests (`pnpm test:run`)
- TypeScript compilation check (`pnpm build`)

## Update version
```shell
# npm
Expand Down Expand Up @@ -179,7 +203,7 @@ input Jira issue ID
name: 'storybook',
emoji: '📚',
description: 'New storybook',
value: 'story'
value: 'storybook'
},
{
name: 'revert',
Expand All @@ -193,5 +217,5 @@ input Jira issue ID
## Todo

- [x] adapt for other projects prefix
- [ ] unit test
- [x] unit test
- [ ] CLI
Loading