|
| 1 | +# This is a workflow that syncs everthing on this repository to another repository |
| 2 | +# using GitLab Token |
| 3 | + |
| 4 | +name: Sync GitHub to GitLab |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + pull_request: |
| 9 | + |
| 10 | + # Allows you to run this workflow manually from the Actions tab |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + push-to-gitlab: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 18 | + steps: |
| 19 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 23 | + |
| 24 | + - name: Print commit author |
| 25 | + run: | |
| 26 | + echo ${{ github.actor }} |
| 27 | +
|
| 28 | + - name: Set remote repository (071yoon) |
| 29 | + if: ${{ github.actor == '071yoon' }} |
| 30 | + env: |
| 31 | + gitlab_url: ${{ secrets.TARGET_URL }} |
| 32 | + gitlab_username: ${{ secrets.TARGET_USERNAME }} |
| 33 | + gitlab_token: ${{ secrets.TARGET_TOKEN }} |
| 34 | + run: | |
| 35 | + git remote add gitlab https://${gitlab_username}:${gitlab_token}@${gitlab_url#https://}; |
| 36 | +
|
| 37 | + - name: Set remote repository (haryung-lee) |
| 38 | + if: ${{ github.actor == 'haryung-lee' }} |
| 39 | + env: |
| 40 | + gitlab_url: ${{ secrets.TARGET_URL }} |
| 41 | + gitlab_username: ${{ secrets.TARGET_USERNAME_HALANG }} |
| 42 | + gitlab_token: ${{ secrets.TARGET_TOKEN_HALANG }} |
| 43 | + run: | |
| 44 | + git remote add gitlab https://${gitlab_username}:${gitlab_token}@${gitlab_url#https://}; |
| 45 | +
|
| 46 | + - name: Set remote repository (IamGroooooot) |
| 47 | + if: ${{ github.actor == 'IamGroooooot' }} |
| 48 | + env: |
| 49 | + gitlab_url: ${{ secrets.TARGET_URL }} |
| 50 | + gitlab_username: ${{ secrets.TARGET_USERNAME_JUHYEONG }} |
| 51 | + gitlab_token: ${{ secrets.TARGET_TOKEN_JUHYEONG }} |
| 52 | + run: | |
| 53 | + git remote add gitlab https://${gitlab_username}:${gitlab_token}@${gitlab_url#https://}; |
| 54 | +
|
| 55 | + - name: Force push everthing |
| 56 | + run: | |
| 57 | + git push -f --all gitlab; |
| 58 | + git push -f --tags gitlab; |
0 commit comments