Update push_gitlab.yml #13
Workflow file for this run
This file contains 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 GitLab | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
mirror_to_gitlab: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch all history to ensure all branches are included | |
- name: Set up Git | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
- name: Add GitLab remote | |
env: | |
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 | |
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 |