diff --git a/.github/workflows/push_gitlab.yml b/.github/workflows/push_gitlab.yml index 637b1aa..adf2946 100644 --- a/.github/workflows/push_gitlab.yml +++ b/.github/workflows/push_gitlab.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 with: - fetch-depth: 0 # Fetch all history to ensure all branches are included + fetch-depth: 0 # Fetch all history to ensure the current branch is fully included - name: Set up Git run: | @@ -25,10 +25,13 @@ jobs: GITLAB_URL: ${{ secrets.GITLAB_URL }} GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} run: | - git remote set-url origin https://oauth2:$GITLAB_TOKEN@$GITLAB_URL - - name: Push all existing branches to GitLab + git remote add origin https://oauth2:${{ secrets.GITLAB_TOKEN }}@${{ secrets.GITLAB_URL }} + + - name: Push current branch to GitLab + env: + GITLAB_URL: ${{ secrets.GITLAB_URL }} + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} run: | - # Push only existing local branches to GitLab - git branch --list --format='%(refname:short)' | while read local_branch; do - git push origin "$local_branch" - done + # Push the current branch to GitLab + git push origin ${{ github.ref_name }}: +