-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
30 lines (26 loc) · 1.01 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
stages:
- sync_to_github
# Sync from GitLab `main` to GitHub (Keeps GitHub Updated)
sync_to_github:
stage: sync_to_github
only:
- main
script:
- apt-get update && apt-get install -y git
- git config --global user.email "[email protected]"
- git config --global user.name "Alex Benavides"
- rm -rf tmp_repo
- git clone https://[email protected]/redhat-cop/ansible-library.git tmp_repo
- cd tmp_repo
- git remote add gitlab https://abenavid:[email protected]/internal-ansible-library/ansible-library.git
- git fetch --all
- git remote -v
- git checkout main || git checkout -B main origin/main
- git fetch gitlab main || echo "GitLab main branch not found."
# Resolve merge conflicts by favoring GitLab changes
- git merge -X theirs gitlab/main || echo "No changes to merge from GitLab."
- git commit -m "Sync with GitLab main" || echo "No changes to commit."
- git push --force origin main
tags:
- internal
- pah