Merge pull request #356 from JECT-Study/bug/#353/fe #84
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: Mirror to Fork (main & develop) | |
| on: | |
| push: | |
| branches: [main, develop] | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| jobs: | |
| mirror: | |
| # ✅ 포크 레포에서는 아예 실행 안 함 (원본에서만 실행) | |
| if: ${{ !github.event.repository.fork }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (full history, no credentials) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| # ✅ 토큰 존재 확인(원본 레포에 반드시 있어야 함) | |
| - name: Debug / Check token | |
| run: | | |
| echo "==== DEBUG INFO ====" | |
| echo "Current branch: ${{ github.ref_name }}" | |
| if [ -z "${{ secrets.FORK_PUSH_TOKEN }}" ]; then | |
| echo "❌ Token is EMPTY (add FORK_PUSH_TOKEN in Actions Secrets: Classic PAT with repo + workflow)" | |
| exit 1 | |
| else | |
| echo "✅ Token is present (masked in logs)" | |
| fi | |
| git --version | |
| - name: Set git identity | |
| run: | | |
| git config user.name "spotit-ci" | |
| git config user.email "spotit-ci@users.noreply.github.com" | |
| # ✅ Classic PAT (repo + workflow) 사용: username:token 형식 | |
| - name: Add fork remote (Classic PAT with username in URL) | |
| env: | |
| TOKEN: ${{ secrets.FORK_PUSH_TOKEN }} | |
| run: | | |
| git config --global http.https://github.com/.extraheader "" | |
| git remote add fork https://spotit-developer:${TOKEN}@github.com/spotit-developer/JECT-3th-6team.git | |
| echo "==== REMOTE INFO ====" | |
| git remote -v | |
| echo "=====================" | |
| git ls-remote fork | |
| - name: Push current branch to fork | |
| env: | |
| BRANCH: ${{ github.ref_name }} | |
| run: | | |
| echo "==== PUSHING $BRANCH ====" | |
| git push fork ${BRANCH}:${BRANCH} | |
| # 필요 시(히스토리 불일치/브랜치 보호 규칙) ↓ 주석 해제 | |
| # git push fork ${BRANCH}:${BRANCH} --force-with-lease |