Ensure main branch exists #2
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: Push to GitLab | |
on: | |
push: | |
branches: | |
- gitlab | |
jobs: | |
push_to_gitlab: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Ensure main branch exists | |
run: | | |
git checkout -b main || git checkout main | |
- name: Push to GitLab | |
env: | |
GITLAB_URL: ${{ secrets.GITLAB_URL }} | |
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
run: | | |
git remote add gitlab $GITLAB_URL | |
git push gitlab main |