-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (100 loc) · 3.3 KB
/
validate-scripts.yml
File metadata and controls
115 lines (100 loc) · 3.3 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
106
107
108
109
110
111
112
113
114
115
name: Validate Scripts
on:
pull_request:
paths:
- "scripts/**"
- "biome.json"
- "tsconfig.json"
- "package.json"
- "bun.lock"
- ".github/workflows/validate-scripts.yml"
push:
branches:
- main
paths:
- "scripts/**"
- "biome.json"
- "tsconfig.json"
- "package.json"
- "bun.lock"
- ".github/workflows/validate-scripts.yml"
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
validate:
name: Validate script quality
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache Bun dependencies
uses: actions/cache@v5
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Validate script TSDoc coverage (diff)
id: validate-diff
if: github.event_name == 'pull_request'
continue-on-error: true
run: bun run validate:scripts --only-diff --base-ref origin/${{ github.base_ref }} --json-output .tmp/validate-scripts-diagnostics.json
- name: Validate script TSDoc coverage (full)
id: validate-full
if: github.event_name != 'pull_request'
run: bun run validate:scripts
- name: Run tests
run: bun test
- name: Biome check
run: bun run biome:check
- name: TypeScript check
run: bunx tsc --noEmit -p tsconfig.json
- name: Build validate-scripts comment body
id: build_diagnostics
if: github.event_name == 'pull_request' && always()
run: |
mkdir -p .tmp
{
echo "## Validate scripts diagnostics"
echo
if [[ ! -f .tmp/validate-scripts-diagnostics.json ]]; then
echo "✓ No issues detected in script quality checks."
else
diagnostics=$(cat .tmp/validate-scripts-diagnostics.json)
count=$(echo "$diagnostics" | jq '. | length')
if [[ "$count" -gt 0 ]]; then
echo "❌ Found **${count}** issue(s) in script quality checks:"
echo
echo '```'
echo "Run \`bun run validate:scripts --only-diff --base-ref origin/main\` locally to review."
echo '```'
else
echo "✓ No issues detected in script quality checks."
fi
fi
} > .tmp/validate-scripts-comment.md
- name: Post or update validate-scripts comment
if: github.event_name == 'pull_request' && always()
uses: marocchino/sticky-pull-request-comment@v3
with:
path: .tmp/validate-scripts-comment.md
header: validate-scripts-check
- name: Fail if validation failed
if: github.event_name == 'pull_request' && steps.validate-diff.outcome == 'failure'
run: exit 1