-
Notifications
You must be signed in to change notification settings - Fork 12
78 lines (65 loc) · 2.15 KB
/
Copy pathindex-templates.yml
File metadata and controls
78 lines (65 loc) · 2.15 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: Index Spec Templates
on:
push:
branches:
- main
paths:
- 'TEMPLATES.md'
schedule:
# Run every hour
- cron: '0 * * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
index-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install js-yaml
- name: Process templates and generate JSON
run: node .github/scripts/process-templates.js
- name: Commit and push to main branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add templates.json
# Only commit if there are changes
if git diff --staged --quiet; then
echo "No changes to templates.json on main branch"
else
git commit -m "Update templates.json [automated]"
git push
echo "✓ Successfully updated templates.json on main branch"
fi
- name: Checkout pages branch
uses: actions/checkout@v4
with:
ref: pages
path: pages-branch
- name: Copy templates.json to pages branch
run: |
mkdir -p pages-branch/docs
cp templates.json pages-branch/docs/templates.json
- name: Commit and push to pages branch
run: |
cd pages-branch
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/templates.json
# Only commit if there are changes
if git diff --staged --quiet; then
echo "No changes to templates.json"
else
git commit -m "Update templates.json [automated]"
git push
echo "✓ Successfully updated templates.json on pages branch"
fi