forked from mem9-ai/mem9
-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (31 loc) · 968 Bytes
/
sync-fork.yml
File metadata and controls
33 lines (31 loc) · 968 Bytes
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
name: Sync fork with upstream
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Sync fork
uses: actions/github-script@v7
with:
script: |
const result = await github.rest.repos.mergeUpstream({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
});
const mergeType = result.data.merge_type ?? 'none';
console.log(`Sync result: ${mergeType}`);
if (mergeType !== 'none') {
console.log('New commits synced, triggering build-swr workflow');
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-swr.yml',
ref: 'main',
});
}