Repository navigation
61 lines (51 loc) · 1.77 KB
/
Copy pathsync-data.yml
File metadata and controls
61 lines (51 loc) · 1.77 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
name: Sync game data
on:
schedule:
- cron: '17 */6 * * *'
workflow_dispatch:
# Check changes to the sync itself without publishing anything.
pull_request:
paths:
- 'scripts/**'
- '.github/workflows/sync-data.yml'
permissions:
contents: write
pull-requests: write
issues: write
concurrency:
group: sync-data
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Test the sync script
run: node --test scripts/sync-data.test.mjs
- name: Dry run
if: github.event_name == 'pull_request'
run: node scripts/sync-data.mjs --dry-run
- name: Build and check data
id: sync
if: github.event_name != 'pull_request'
run: node scripts/sync-data.mjs --report "$RUNNER_TEMP/sync-report.md"
- name: Publish
if: steps.sync.outputs.status == 'publish' || steps.sync.outputs.status == 'review'
env:
GH_TOKEN: ${{ github.token }}
STATUS: ${{ steps.sync.outputs.status }}
run: bash scripts/publish-sync.sh "$STATUS" "$RUNNER_TEMP/sync-report.md"
- name: Report failure
if: failure() && github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
title='Data sync is failing'
existing=$(gh issue list --state open --search "\"$title\" in:title" --json number --jq '.[0].number // empty')
if [ -z "$existing" ]; then
gh issue create --title "$title" --body "The live site still has the last good data. Details: $RUN_URL"
fi