-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (69 loc) · 2.39 KB
/
pr.yml
File metadata and controls
86 lines (69 loc) · 2.39 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
name: Pull Request
on:
pull_request:
branches: [ main, develop ]
jobs:
test-and-build:
name: Test & Build PR
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run TypeScript check
run: npm run typecheck
- name: Run linting
run: npm run lint
- name: Run tests
run: npm run test:ci
- name: Build plugin
run: npm run build
- name: Check build size
run: |
echo "## Build Results 📊" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------|------|" >> $GITHUB_STEP_SUMMARY
ls -lh dist/*.js | awk '{print "| " $9 " | " $5 " |"}' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Total dist size: $(du -sh dist | cut -f1)" >> $GITHUB_STEP_SUMMARY
- name: Upload PR build artifacts
uses: actions/upload-artifact@v7
with:
name: pr-build-${{ github.event.number }}
path: dist/
retention-days: 7
comment-pr:
name: Comment on PR
runs-on: ubuntu-latest
needs: test-and-build
if: github.event_name == 'pull_request'
steps:
- name: Comment PR
uses: actions/github-script@v8
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## ✅ Build Successful!
Your pull request has been built successfully. You can download the build artifacts to test the changes.
### 📦 Artifacts
- Build artifacts are available for 7 days
- Download link will appear in the "Artifacts" section of the workflow run
### 🧪 Testing
To test this build:
1. Download the build artifacts
2. Extract to your Grafana plugins directory
3. Restart Grafana
4. Test the plugin functionality
---
*This comment was automatically generated by GitHub Actions*`
});