-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (99 loc) · 3.82 KB
/
shadcn-check.yml
File metadata and controls
117 lines (99 loc) · 3.82 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
116
117
name: Check Shadcn Components
on:
# Run weekly on Mondays at 9:00 AM UTC
schedule:
- cron: '0 9 * * 1'
# Allow manual trigger
workflow_dispatch:
jobs:
check-components:
name: Check for Shadcn Component Updates
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: true
- name: Enable Corepack
run: corepack enable
- name: Verify pnpm version
run: pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Analyze components (offline)
id: analyze
run: |
echo "Running offline component analysis..."
pnpm shadcn:analyze > analysis.txt
cat analysis.txt
continue-on-error: true
- name: Check component status (online)
id: check
run: |
echo "Checking component status against Shadcn registry..."
pnpm shadcn:check > check.txt
cat check.txt
continue-on-error: true
- name: Upload analysis results
uses: actions/upload-artifact@v7
if: always()
with:
name: shadcn-analysis
path: |
analysis.txt
check.txt
retention-days: 30
- name: Create issue if components are outdated
if: failure()
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
let body = '## Shadcn Components Status Report\n\n';
body += 'The weekly component sync check has detected issues or updates.\n\n';
if (fs.existsSync('analysis.txt')) {
const analysis = fs.readFileSync('analysis.txt', 'utf8');
body += '### Offline Analysis\n\n';
body += '```\n' + analysis.substring(0, 5000) + '\n```\n\n';
}
if (fs.existsSync('check.txt')) {
const check = fs.readFileSync('check.txt', 'utf8');
body += '### Online Check Results\n\n';
body += '```\n' + check.substring(0, 5000) + '\n```\n\n';
}
body += '### Next Steps\n\n';
body += '1. Review the analysis results above\n';
body += '2. Run `pnpm shadcn:analyze` locally for detailed information\n';
body += '3. Update components as needed with `pnpm shadcn:update <component>`\n';
body += '4. See [SHADCN_SYNC.md](../blob/main/docs/SHADCN_SYNC.md) for detailed guide\n\n';
body += '> This issue was automatically created by the Shadcn Components Check workflow.\n';
// Check if there's already an open issue
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'shadcn-sync',
});
if (issues.data.length > 0) {
// Update existing issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues.data[0].number,
body: '## Updated Check Results\n\n' + body,
});
} else {
// Create new issue
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Shadcn Components Need Review',
body: body,
labels: ['maintenance', 'shadcn-sync', 'dependencies'],
});
}