-
Notifications
You must be signed in to change notification settings - Fork 17
70 lines (56 loc) · 1.94 KB
/
nightly.yml
File metadata and controls
70 lines (56 loc) · 1.94 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
name: Nightly Prettier Latest
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
test-prettier-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v5
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'pnpm'
- run: pnpm add -D prettier@latest -w
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm test
- name: Create or comment on issue
if: failure()
uses: actions/github-script@v9
with:
script: |
const issueTitle = 'Nightly Prettier Latest Test Failed';
// Search for existing open issue
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['automated', 'test-failure']
});
const existingIssue = issues.data.find(issue => issue.title === issueTitle);
const body = `Test failed on run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
**Commit:** ${{ github.sha }}
**Date:** ${new Date().toISOString()}`;
if (existingIssue) {
// Add comment to existing issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existingIssue.number,
body: body
});
} else {
// Create new issue
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: issueTitle,
body: body,
labels: ['automated', 'test-failure']
});
}