Skip to content

chore: trigger sync name (testing) #6

chore: trigger sync name (testing)

chore: trigger sync name (testing) #6

Workflow file for this run

name: Sync Fork Repository
on:
push:
branches:
- main
- dev
repository_dispatch:
types: [upstream-update]
workflow_dispatch:
env:
FORK_REPO: "git-good-w/git-animal-client"
UPSTREAM_REPO: "git-goods/git-animal-client"
jobs:
trigger-sync:
if: vars.IS_FORK_REPO == ''
runs-on: ubuntu-latest
steps:
- name: Trigger fork repository sync
run: |
echo "πŸš€ Triggering sync for fork: ${{ env.FORK_REPO }}"
echo "πŸ“Œ Branch pushed: ${{ github.ref_name }}"
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.FORK_SYNC_TOKEN }}" \
https://api.github.com/repos/${{ env.FORK_REPO }}/dispatches \
-d '{"event_type":"upstream-update","client_payload":{"branch":"${{ github.ref_name }}","commit":"${{ github.sha }}"}}'
echo "βœ… Fork sync triggered"
sync-upstream:
if: vars.IS_FORK_REPO != ''
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync with upstream
run: |
echo "πŸ”„ Syncing from upstream: ${{ env.UPSTREAM_REPO }}"
git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }}.git
git fetch upstream
# main 브랜치 동기화
echo "πŸ“¦ Syncing main branch..."
git checkout -B main origin/main
git merge upstream/main --no-edit
git push origin main
echo "βœ… main branch synced"
# dev 브랜치 동기화
echo "πŸ“¦ Syncing dev branch..."
git checkout -B dev origin/dev 2>/dev/null || git checkout -b dev upstream/dev
git merge upstream/dev --no-edit
git push origin dev
echo "βœ… dev branch synced"
- name: Summary
run: |
echo "✨ Sync completed successfully!"
echo "Upstream: ${{ env.UPSTREAM_REPO }}"