Repository navigation
40 lines (40 loc) · 1.76 KB
/
Copy pathsync.yml
File metadata and controls
40 lines (40 loc) · 1.76 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
# Keeps this repository equal to what packages/mcp/scripts/plugin-repo.mjs in genclass-dev/GenClass-lib assembles
# (that script fetches the released server from npm and vendors it under server/). Nothing here is edited by hand:
# this workflow overwrites everything but .git and .github (the default token cannot change workflow files, so this
# file is updated from GenClass-lib by a person). Exit code 3 from the script means GenClass-lib's version is not on
# npm yet (between a bump and its release): the repository then stays as it is.
name: Sync from GenClass-lib
on:
schedule:
- cron: "23 6 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: genclass-dev/GenClass-lib
ref: main
path: lib
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Assemble from GenClass-lib
run: |
SHA=$(git -C lib rev-parse --short HEAD)
rc=0; node lib/packages/mcp/scripts/plugin-repo.mjs out || rc=$?
if [ "$rc" = 0 ]; then rsync -a --delete --exclude .git --exclude .github --exclude lib --exclude out out/ ./; fi
rm -rf lib out
if [ "$rc" = 3 ]; then echo "GenClass-lib's version is not on npm yet: nothing to do until the release"; exit 0; fi
[ "$rc" = 0 ] || exit "$rc"
echo "SHA=$SHA" >> "$GITHUB_ENV"
- name: Commit and push when something changed
run: |
git add -A
if git diff --cached --quiet; then echo "nothing changed"; exit 0; fi
git -c user.name=genclass-sync -c user.email=noreply@genclass.dev commit -m "sync from GenClass-lib $SHA"
git push