-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 1.16 KB
/
sync-codetree.yml
File metadata and controls
45 lines (36 loc) · 1.16 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
name: Sync Codetree Subtree
on:
repository_dispatch:
types: [sync-codetree]
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Algorithm repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup SSH access
run: |
mkdir -p ~/.ssh
echo "${{ secrets.CODETREE_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Set Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Add codetree remote via SSH
run: |
git remote remove codetree 2>/dev/null || true
git remote add codetree git@github.com:hanjaek/Codetree.git
git fetch codetree main
- name: Pull subtree
run: |
git subtree pull --prefix=Codetree codetree main --squash -m "auto sync Codetree" || echo "No changes"
- name: Push
run: |
git push origin HEAD:main || echo "Nothing to push"