Repository navigation
105 lines (89 loc) · 2.78 KB
/
Copy pathpr.yml
File metadata and controls
105 lines (89 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: PR Checks
on:
pull_request:
branches: ["*"]
paths-ignore:
- "public/tools-collection/**"
- "public/tools.json"
jobs:
lint-format:
runs-on: ubuntu-latest
name: Lint and Format Code
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Cache Bun dependencies
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- run: bun run lint
- run: bun run format:check
build-test:
runs-on: ubuntu-latest
name: Build and Test
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Cache Bun dependencies
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Generate specifications
run: bun run specification:build
- name: Build registry
run: bun run registry:build
- name: Commit changes if any
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
if git diff --quiet; then
echo "No changes to commit"
else
git add .
git commit -m "chore: update generated specifications and registry"
git push origin HEAD:${{ github.head_ref }}
fi
- run: bun run build
- run: bun run coverage
- name: Write coverage summary
if: always()
run: |
bun -e "
const s = require('./coverage/coverage-summary.json');
const t = s.total;
const fmt = (m) => \`\${m.pct}% (\${m.covered}/\${m.total})\`;
const lines = [
'## Test Coverage',
'| Metric | Coverage |',
'|--------|----------|',
\`| Statements | \${fmt(t.statements)} |\`,
\`| Branches | \${fmt(t.branches)} |\`,
\`| Functions | \${fmt(t.functions)} |\`,
\`| Lines | \${fmt(t.lines)} |\`,
].join('\n');
require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, lines + '\n');
"