Skip to content

Commit

Permalink
Update push_gitlab.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
roquelopez authored Jun 7, 2024
1 parent f4c367b commit 9698c36
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/push_gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 }}:

0 comments on commit 9698c36

Please sign in to comment.