[level 2] Title: 카테고리 별 상품 개수 구하기, Time: , Memory: undefined -Baekjoo… #38
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 to Shared Repository | |
| on: | |
| push: | |
| branches: [ main ] # 개인 레포지토리의 main 브랜치에 푸시될 때 트리거 | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 개인 레포지토리(SangHyeok0908/Algorithm) 체크아웃 | |
| - name: Checkout Personal Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| path: personal-repo | |
| # 2. Organization 공용 레포지토리(ensharp-algorithm/study-authentication) 체크아웃 | |
| - name: Checkout Shared Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: ensharp-algorithm/study-authentication | |
| token: ${{ secrets.PAT_TOKEN }} # 개인 레포 Settings에 등록한 Secret Name | |
| path: shared-repo | |
| # 3. 파일 복사 (개인 레포 전체 -> 공용 레포의 sanghyeok0908 폴더) | |
| - name: Copy files | |
| run: | | |
| # 공용 레포 내에 본인 식별용 폴더 생성 | |
| mkdir -p shared-repo/sanghyeok0908 | |
| # 형상관리 플러그인 설정(.git, .github)을 제외한 알고리즘 소스 코드 복사 | |
| rsync -av --exclude='.git' --exclude='.github' personal-repo/ shared-repo/sanghyeok0908/ | |
| # 4. 공용 레포지토리에 커밋 및 푸시 | |
| - name: Commit and Push to Shared Repository | |
| run: | | |
| cd shared-repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| # 변경 사항이 있을 때만 커밋 및 푸시 진행 (에러 방지) | |
| if git diff-index --quiet HEAD --; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-sync: sanghyeok0908 알고리즘 문제 풀이 업데이트" | |
| git push origin main | |
| fi |