Skip to content

fix(code): add missing JSDoc for none() and equalsWith() #189

fix(code): add missing JSDoc for none() and equalsWith()

fix(code): add missing JSDoc for none() and equalsWith() #189

Workflow file for this run

name: Coverage
on:
push:
branches: [main]
paths:
- 'packages/core/src/**'
- 'packages/core/tests/**'
- 'packages/core/vitest.config.ts'
- 'packages/core/tsconfig.json'
pull_request:
branches: [main]
paths:
- 'packages/core/src/**'
- 'packages/core/tests/**'
- 'packages/core/vitest.config.ts'
- 'packages/core/tsconfig.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm turbo build --filter=@deessejs/core
coverage:
name: Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests with coverage
run: |
cd packages/core
npx vitest run --coverage
- name: Find coverage comment
if: github.event_name == 'pull_request'
id: find-comment
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const { number } = context.payload.pull_request;
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: number
});
const existingComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Coverage Report')
);
if (existingComment) {
console.log(`Found existing comment: ${existingComment.id}`);
return existingComment.id;
}
return null;
- name: Comment coverage on PR
if: github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
try {
const fs = require('fs');
const coveragePath = './packages/core/coverage/coverage-summary.json';
if (!fs.existsSync(coveragePath)) {
console.log('Coverage file not found, skipping comment');
return;
}
const coverage = JSON.parse(fs.readFileSync(coveragePath, 'utf8'));
const lines = coverage.total.lines;
const statements = coverage.total.statements;
const functions = coverage.total.functions;
const branches = coverage.total.branches;
const body = '## Coverage Report\n\n' +
'| Metric | Coverage |\n' +
'|--------|----------|\n' +
'| Lines | ' + lines.pct + '% |\n' +
'| Statements | ' + statements.pct + '% |\n' +
'| Functions | ' + functions.pct + '% |\n' +
'| Branches | ' + branches.pct + '% |\n\n' +
'> Coverage report generated by GitHub Actions';
const commentId = ${{ steps.find-comment.outputs.result }};
if (commentId) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId,
body: body
});
console.log('Updated existing coverage comment');
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: body
});
console.log('Created new coverage comment');
}
} catch (error) {
console.log('Failed to post coverage comment:', error.message);
}