Skip to content

fix(scorer): add files field, bump all packages to 0.2.3 #16

fix(scorer): add files field, bump all packages to 0.2.3

fix(scorer): add files field, bump all packages to 0.2.3 #16

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths:
- 'packages/**'
- 'knowledge/**'
- '.github/workflows/ci.yml'
- 'package.json'
- 'tsconfig.base.json'
pull_request:
branches: [main]
paths:
- 'packages/**'
- 'knowledge/**'
- '.github/workflows/ci.yml'
- 'package.json'
- 'tsconfig.base.json'
jobs:
ci:
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build scorer
run: npm run build --workspace=packages/scorer
- name: Build packages
run: npm run build
- name: Validate knowledge schema
run: node scripts/validate-knowledge.js
continue-on-error: false
- name: Run tests
id: run_tests
continue-on-error: true
run: |
set -o pipefail
npm test -- --run 2>&1 | tee /tmp/test-output.txt
- name: Post test failure comment
if: github.event_name == 'pull_request' && steps.run_tests.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let output = '';
try {
output = fs.readFileSync('/tmp/test-output.txt', 'utf8').slice(0, 4000);
} catch (e) {
output = '(could not read test output)';
}
const body = [
'## ❌ Test Suite Failed — PR cannot be merged',
'',
'### What failed',
'',
'The test suite did not pass on Node.js `${{ matrix.node-version }}`. All tests must pass before this PR can be merged.',
'',
'<details>',
'<summary>Test output (first 4000 characters)</summary>',
'',
'```',
output,
'```',
'',
'</details>',
'',
'### How to fix',
'',
'1. Pull the latest changes from this branch locally.',
'2. Run `npm test -- --run` in the repository root to reproduce the failures.',
'3. Fix the failing tests or the code that causes them to fail.',
'4. Push your fixes — CI will re-run automatically.',
'',
'> **Note:** ALL tests must pass before this PR can be merged.',
].join('\n');
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});
- name: Fail build if tests failed
if: steps.run_tests.outcome == 'failure'
run: exit 1
- name: Score new knowledge entries
if: github.event_name == 'pull_request'
id: score_entries
run: node scripts/score-pr-knowledge.js
continue-on-error: true
- name: Comment PR with knowledge scores
if: github.event_name == 'pull_request' && steps.score_entries.outputs.scores != ''
uses: actions/github-script@v7
with:
script: |
const scores = process.env.KNOWLEDGE_SCORES;
if (scores) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Fluently Knowledge Entry Fluency Scores\n\n${scores}`
});
}
env:
KNOWLEDGE_SCORES: ${{ steps.score_entries.outputs.scores }}