Repository navigation
79 lines (68 loc) · 2.5 KB
/
Copy pathsites.yml
File metadata and controls
79 lines (68 loc) · 2.5 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
# Keeps the site list current with no manual steps.
#
# Monthly (and on demand from the Actions tab): checks every site in sites.json, removes ones no longer
# made with Angular, updates versions/dates/changelog and the derived files, commits, and opens an issue
# with the report. The push to main triggers the normal Netlify deploy.
#
# On any push that edits sites.json: regenerates the derived files (slugs, routes.txt, sitemap.xml,
# llms.txt, index.html JSON-LD) and commits them.
name: Sites
on:
schedule:
- cron: '0 16 1 * *' # 16:00 UTC on the 1st of each month
workflow_dispatch:
push:
branches: [main]
paths: [sites.json]
permissions:
contents: write
issues: write
concurrency:
group: sites
cancel-in-progress: false
jobs:
sites:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
FULL_CHECK: ${{ github.event_name != 'push' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: bot/package-lock.json
- name: Install checker
if: env.FULL_CHECK == 'true'
working-directory: bot
run: |
npm ci
npx puppeteer browsers install chrome
- name: Check every site
if: env.FULL_CHECK == 'true'
run: node bot/check.js --report "$RUNNER_TEMP/report.md"
- name: Regenerate site files
run: node bot/generate.js
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A sites.json changelog.json routes.txt src/index.html src/sitemap.xml src/llms.txt src/assets/img
if git diff --cached --quiet; then
echo "No changes."
else
git commit -m "${{ env.FULL_CHECK == 'true' && 'Check all sites.' || 'Regenerate site files.' }}"
git push
fi
- name: Report
if: env.FULL_CHECK == 'true' && always()
env:
GH_TOKEN: ${{ github.token }}
run: |
REPORT="$RUNNER_TEMP/report.md"
if [ ! -f "$REPORT" ]; then
printf '## Site check failed\n\nThe check did not finish. See the run log: %s\n' "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > "$REPORT"
fi
cat "$REPORT" >> "$GITHUB_STEP_SUMMARY"
gh issue create --title "Site check $(date -u +%Y-%m-%d)" --body-file "$REPORT"