Repository navigation
55 lines (47 loc) · 1.8 KB
/
Copy pathbuild-index.yml
File metadata and controls
55 lines (47 loc) · 1.8 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
name: Build organization repository index
# Rebuilds data/repos.json and README.md from the current state
# of every repository in the Demo-Math-Journal organization, then commits the
# result if anything changed. See ../../SETUP.md for how this works.
on:
schedule:
# 07:17 UTC daily (~3:17am US Eastern during EDT, 2:17am during EST).
# Off-peak minute/hour to avoid GitHub Actions' top-of-hour congestion.
- cron: '17 7 * * *'
workflow_dispatch: {}
permissions:
contents: write
# Prevent overlapping builds; let a queued run wait rather than cancel.
concurrency:
group: build-index
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v4
with:
# Uses INDEX_REPO_TOKEN if you've added one (see SETUP.md — needed
# when your organization's default workflow permissions are
# locked to read-only), otherwise falls back to the default token.
token: ${{ secrets.INDEX_REPO_TOKEN || secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build the index
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ORG: Demo-Math-Journal
run: node scripts/build-index.mjs
- name: Commit and push if the index changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md data/repos.json
if git diff --cached --quiet; then
echo "No changes to the index — nothing to commit."
else
git commit -m "chore: rebuild organization repository index"
git push
fi