-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (61 loc) · 2.34 KB
/
validate-mocks.yml
File metadata and controls
78 lines (61 loc) · 2.34 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
name: Validate Mock Selectors
on:
schedule:
# Run weekly on Mondays at 9am UTC
- cron: '0 9 * * 1'
workflow_dispatch:
jobs:
validate:
name: Validate Provider Selectors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium
- name: Validate mock selectors
id: validate
continue-on-error: true
run: npm run validate:mocks
- name: Create issue on failure
if: steps.validate.outcome == 'failure'
uses: actions/github-script@v8
with:
script: |
const title = 'Mock Selector Validation Failed';
const body = `## Mock Selector Validation Failed
The weekly validation of mock provider selectors has detected issues.
This means one or more genealogy providers have updated their website structure,
and our mock templates may need to be updated to match.
### Action Required
1. Review the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})
2. Update the affected selectors in \`tests/__mocks__/providers/*/selectors.json\`
3. Update the corresponding HTML templates in \`tests/__mocks__/providers/*/pages/\`
4. Re-run the scraper tests to verify
### Affected Run
- Workflow: ${context.workflow}
- Run ID: ${context.runId}
- Date: ${new Date().toISOString()}
/label mock-validation`;
// Check if issue already exists
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'mock-validation',
state: 'open'
});
if (issues.length === 0) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: ['mock-validation', 'maintenance']
});
}