forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.47 KB
/
sync-upstream.yml
File metadata and controls
53 lines (45 loc) · 1.47 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
name: sync-upstream
on:
schedule:
- cron: "17 2 * * 5"
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
actions: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: zexi/dev
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Rebase zexi/dev onto upstream dev
run: |
git remote add upstream https://github.com/anomalyco/opencode.git
git fetch upstream dev
git rebase upstream/dev
git push --force-with-lease origin HEAD:zexi/dev
- name: Keep only fork workflows enabled
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
allowlist='
.github/workflows/sync-upstream.yml
.github/workflows/zexi-electron.yml
'
gh workflow list -R "$GH_REPO" --limit 200 --json path \
| jq -r '.[].path' \
| while read -r workflow; do
if printf '%s\n' "$allowlist" | sed 's/^ *//' | grep -Fxq "$workflow"; then
gh workflow enable "$workflow" -R "$GH_REPO" || true
else
gh workflow disable "$workflow" -R "$GH_REPO" || true
fi
done