-
Notifications
You must be signed in to change notification settings - Fork 19
75 lines (68 loc) · 2.43 KB
/
nightly.yml
File metadata and controls
75 lines (68 loc) · 2.43 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
name: Nightly data update
on:
# schedule:
# - cron: '0 4 * * *'
workflow_dispatch:
permissions:
contents: write
issues: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uv python install 3.13
- run: uv sync
- run: uv run preprocess
- run: uv run postprocess
- name: Validate data quality
id: validate
continue-on-error: true
run: uv run validate
- name: Commit and push if changed
if: steps.validate.outcome == 'success'
run: |
git diff --quiet data.json && exit 0
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data.json validation_report.json validation_report.csv
git commit -m "chore: nightly data update"
git push
- name: Create issue on quality gate failure
if: steps.validate.outcome == 'failure'
run: |
existing=$(gh issue list --label quality-gate --state open --limit 1 --json number -q '.[0].number')
if [ -n "$existing" ]; then
gh issue comment "$existing" --body "Quality gate failed again on $(date -u +%Y-%m-%d). See [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
else
gh issue create \
--title "Quality gate failure: nightly data update" \
--label quality-gate \
--body "The nightly data update failed the quality gate on $(date -u +%Y-%m-%d).
**Action required:** Review the validation report and fix upstream data issues.
See [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail workflow on quality gate failure
if: steps.validate.outcome == 'failure'
run: exit 1
deploy:
needs: update-data
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- uses: actions/upload-pages-artifact@v4
with:
path: .
- id: deployment
uses: actions/deploy-pages@v4