Skip to content

Commit 0b2d045

Browse files
Fix GitHub to GitLab Sync: (#12)
* test-trigger * test * qa push validation * test qa push * validate * test
1 parent 0c7f76f commit 0b2d045

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

.github/workflows/sync-github-to-gitlab.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Checkout GitHub Repository
1414
uses: actions/checkout@v2
1515
with:
16-
fetch-depth: 0 # Fetch the full history to ensure full context
16+
fetch-depth: 0 # Fetch full history for context
1717

1818
# Step 2: Configure Git identity
1919
- name: Configure Git Identity
@@ -37,18 +37,15 @@ jobs:
3737
- name: Fetch GitLab qa branch
3838
run: git fetch gitlab qa || true # Ensure GitLab qa branch is fetched
3939

40-
# Step 6: Reconcile Divergent Histories
41-
- name: Reconcile Divergent Histories
40+
# Step 6: Checkout GitLab qa branch
41+
- name: Checkout GitLab qa branch
4242
run: |
43-
# Checkout the current branch
44-
git checkout main
43+
git checkout qa || git checkout -b qa gitlab/qa
4544
46-
# Merge GitLab qa branch into GitHub main branch, allowing unrelated histories
47-
git merge gitlab/qa --allow-unrelated-histories --strategy-option=theirs || true
45+
# Step 7: Merge GitHub main into GitLab qa
46+
- name: Merge GitHub main into GitLab qa
47+
run: git merge origin/main --allow-unrelated-histories --strategy-option=theirs || true
4848

49-
# Force push to GitLab if necessary
50-
git push gitlab qa || git push --force gitlab qa
51-
52-
# Step 7: Push Final Changes to GitLab qa branch
49+
# Step 8: Push only to GitLab qa
5350
- name: Push Final Changes to GitLab qa branch
54-
run: git push gitlab main:qa
51+
run: git push gitlab qa

0 commit comments

Comments
 (0)