Update GitLab workflow to use 'actions/checkout@v4' instead of 'actio… #3
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: Sync to GitLab | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
sync_to_gitlab: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up GitLab Remote URL | |
run: echo "GITLAB_FULL_REPO=https://oauth2:${{ secrets.GITLAB_TOKEN }}@${{ secrets.GITLAB_REPO }}" >> $GITHUB_ENV | |
- name: Push to GitLab | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
git remote add gitlab ${{ env.GITLAB_FULL_REPO }} | |
git fetch gitlab | |
git checkout -b gitlab-temp-branch origin/master # Create a temporary branch based on master | |
git push gitlab gitlab-temp-branch:${{ secrets.GITLAB_SYNC_BRANCH }} --force | |
env: | |
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} |