Sync Codetree Subtree #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |