Skip to content

Commit cdb6ad9

Browse files
committed
Merge branch 'dev' of github.com:contentstack/migration-v2-node-server into feature/CMG-528
2 parents 3512d6b + 24ac285 commit cdb6ad9

File tree

43 files changed

+2633
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2633
-161
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/repo-sync.yml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Sync Changes to different CMS repos on PR Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed] # Triggers when a PR is closed
6+
branches:
7+
- dev # Change this to your default branch if needed
8+
9+
env:
10+
BRANCH : dev # Change this to your default branch if needed
11+
SITECORE_REPO: contentstack-expert-services/migration-tool-sitecore # Change this to your sitecore repo
12+
CONTENTFUL_REPO: contentstack-expert-services/migration-tool-contentful # Change this to your contentful repo
13+
WORDPRESS_REPO: contentstack-expert-services/migration-tool-wordpress # Change this to your wordpress repo
14+
RSYNC_SITECORE_API_SRC_SERVICES_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts' --exclude 'src/services/wordpress.service.ts'" # Include only sitecore services
15+
RSYNC_CONTENTFUL_API_SRC_SERVICES_EXCLUDES: "--exclude 'src/services/wordpress.service.ts' --exclude 'src/services/sitecore.service.ts'" # Include only contentful services
16+
RSYNC_WORDPRESS_API_SRC_SERVICES_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts' --exclude 'src/services/sitecore.service.ts'" # Include only wordpress services
17+
RSYNC_SITECORE_UPLOAD_API_SRC_EXCLUDES: "--exclude 'controllers/wordpress/' --exclude 'controllers/contentful/' --exclude 'models/contentful.json' --exclude 'models/wordpress.json' --exclude 'services/contentful/' --exclude 'validators/aem/' --exclude 'validators/contentful/' --exclude 'validators/wordpress/'" # Include only sitecore upload-api
18+
RSYNC_CONTENTFUL_UPLOAD_API_SRC_EXCLUDES: "--exclude 'controllers/sitecore/' --exclude 'controllers/wordpress/' --exclude 'models/wordpress.json' --exclude 'validators/aem/' --exclude 'validators/sitecore/' --exclude 'validators/wordpress/'" # Include only contentful upload-api
19+
RSYNC_WORDPRESS_UPLOAD_API_SRC_EXCLUDES: "--exclude 'controllers/sitecore/' --exclude 'controllers/contentful/' --exclude 'models/contentful.json' --exclude 'services/contentful/' --exclude 'validators/aem/' --exclude 'validators/sitecore/' --exclude 'validators/contentful/'" # Include only wordpress upload-api
20+
jobs:
21+
sync-on-merge:
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
28+
steps:
29+
- name: Check if PR was merged
30+
id: check_merge
31+
run: |
32+
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then
33+
echo "PR was merged. Proceeding with sync."
34+
echo "merged=true" >> $GITHUB_ENV
35+
else
36+
echo "PR was closed without merging. Skipping sync."
37+
echo "merged=false" >> $GITHUB_ENV
38+
fi
39+
shell: bash
40+
41+
- name: Checkout migration-v2
42+
if: env.merged == 'true'
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0 # Fetch full history to compare changes
46+
47+
- name: Detect changed files
48+
if: env.merged == 'true'
49+
id: file_changes
50+
uses: dorny/paths-filter@v3
51+
with:
52+
filters: |
53+
api:
54+
- 'api/**'
55+
cli:
56+
- 'cli/**'
57+
ui:
58+
- 'ui/**'
59+
upload-api:
60+
- 'upload-api/src/**'
61+
migration-sitecore:
62+
- 'upload-api/migration-sitecore/**'
63+
migration-contentful:
64+
- 'upload-api/migration-contentful/**'
65+
migration-wordpress:
66+
- 'upload-api/migration-wordpress/**'
67+
index:
68+
- 'index.js'
69+
70+
- name: Setup Git
71+
if: env.merged == 'true'
72+
run: |
73+
git config --global user.name "github-actions"
74+
git config --global user.email "[email protected]"
75+
76+
- name: Sync changes to sitecore-repo (if applicable)
77+
if: |
78+
env.merged == 'true' &&
79+
(
80+
steps.file_changes.outputs.api == 'true' ||
81+
steps.file_changes.outputs.cli == 'true' ||
82+
steps.file_changes.outputs.ui == 'true' ||
83+
steps.file_changes.outputs.upload-api == 'true' ||
84+
steps.file_changes.outputs.migration-sitecore == 'true' ||
85+
steps.file_changes.outputs.index == 'true'
86+
)
87+
run: |
88+
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ env.SITECORE_REPO }}.git
89+
cd migration-tool-sitecore
90+
git checkout -b sync-from-migration-v2-${{ github.event.pull_request.number }}
91+
git pull origin ${{ env.BRANCH }}
92+
rsync -av --delete ${{ env.RSYNC_SITECORE_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
93+
rsync -av --delete ../cli/ ./cli/
94+
rsync -av --delete ../ui/ ./ui/
95+
rsync -av --delete ${{ env.RSYNC_SITECORE_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
96+
rsync -av --delete ../upload-api/migration-sitecore/ ./upload-api/migration-sitecore/
97+
git add .
98+
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
99+
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
100+
101+
- name: Create PR in sitecore-repo
102+
if: |
103+
env.merged == 'true' &&
104+
(
105+
steps.file_changes.outputs.api == 'true' ||
106+
steps.file_changes.outputs.cli == 'true' ||
107+
steps.file_changes.outputs.ui == 'true' ||
108+
steps.file_changes.outputs.upload-api == 'true' ||
109+
steps.file_changes.outputs.migration-sitecore == 'true' ||
110+
steps.file_changes.outputs.index == 'true'
111+
)
112+
run: |
113+
gh pr create --repo ${{ env.SITECORE_REPO }} \
114+
--title "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}" \
115+
--body "This PR syncs changes from migration-v2:\n${{ github.event.pull_request.html_url }}" \
116+
--head sync-from-migration-v2-${{ github.event.pull_request.number }} \
117+
--base ${{ env.BRANCH }}
118+
env:
119+
GH_TOKEN: ${{ secrets.GH_PAT }}
120+
121+
- name: Sync changes to contentful-repo (if applicable)
122+
if: |
123+
env.merged == 'true' &&
124+
(
125+
steps.file_changes.outputs.api == 'true' ||
126+
steps.file_changes.outputs.cli == 'true' ||
127+
steps.file_changes.outputs.ui == 'true' ||
128+
steps.file_changes.outputs.upload-api == 'true' ||
129+
steps.file_changes.outputs.migration-contentful == 'true' ||
130+
steps.file_changes.outputs.index == 'true'
131+
)
132+
run: |
133+
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ env.CONTENTFUL_REPO }}.git
134+
cd migration-tool-contentful
135+
git checkout -b sync-from-migration-v2-${{ github.event.pull_request.number }}
136+
git pull origin ${{ env.BRANCH }}
137+
rsync -av --delete ${{ env.RSYNC_CONTENTFUL_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
138+
rsync -av --delete ../cli/ ./cli/
139+
rsync -av --delete ../ui/ ./ui/
140+
rsync -av --delete ${{ env.RSYNC_CONTENTFUL_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
141+
rsync -av --delete ../upload-api/migration-contentful/ ./upload-api/migration-contentful/
142+
git add .
143+
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
144+
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
145+
146+
- name: Create PR in contentful-repo
147+
if: |
148+
env.merged == 'true' &&
149+
(
150+
steps.file_changes.outputs.api == 'true' ||
151+
steps.file_changes.outputs.cli == 'true' ||
152+
steps.file_changes.outputs.ui == 'true' ||
153+
steps.file_changes.outputs.upload-api == 'true' ||
154+
steps.file_changes.outputs.migration-contentful == 'true' ||
155+
steps.file_changes.outputs.index == 'true'
156+
)
157+
run: |
158+
gh pr create --repo ${{ env.CONTENTFUL_REPO }} \
159+
--title "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}" \
160+
--body "This PR syncs changes from migration-v2:\n${{ github.event.pull_request.html_url }}" \
161+
--head sync-from-migration-v2-${{ github.event.pull_request.number }} \
162+
--base ${{ env.BRANCH }}
163+
env:
164+
GH_TOKEN: ${{ secrets.GH_PAT }}
165+
166+
- name: Sync changes to wordpress-repo (if applicable)
167+
if: |
168+
env.merged == 'true' &&
169+
(
170+
steps.file_changes.outputs.api == 'true' ||
171+
steps.file_changes.outputs.cli == 'true' ||
172+
steps.file_changes.outputs.ui == 'true' ||
173+
steps.file_changes.outputs.upload-api == 'true' ||
174+
steps.file_changes.outputs.migration-wordpress == 'true' ||
175+
steps.file_changes.outputs.index == 'true'
176+
)
177+
run: |
178+
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ env.WORDPRESS_REPO }}.git
179+
cd migration-tool-wordpress
180+
git checkout -b sync-from-migration-v2-${{ github.event.pull_request.number }}
181+
git pull origin ${{ env.BRANCH }}
182+
rsync -av --delete ${{ env.RSYNC_WORDPRESS_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
183+
rsync -av --delete ../cli/ ./cli/
184+
rsync -av --delete ../ui/ ./ui/
185+
rsync -av --delete ${{ env.RSYNC_WORDPRESS_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
186+
rsync -av --delete ../upload-api/migration-wordpress/ ./upload-api/migration-wordpress/
187+
git add .
188+
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
189+
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
190+
191+
- name: Create PR in wordpress-repo
192+
if: |
193+
env.merged == 'true' &&
194+
(
195+
steps.file_changes.outputs.api == 'true' ||
196+
steps.file_changes.outputs.cli == 'true' ||
197+
steps.file_changes.outputs.ui == 'true' ||
198+
steps.file_changes.outputs.upload-api == 'true' ||
199+
steps.file_changes.outputs.migration-wordpress == 'true' ||
200+
steps.file_changes.outputs.index == 'true'
201+
)
202+
run: |
203+
gh pr create --repo ${{ env.WORDPRESS_REPO }} \
204+
--title "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}" \
205+
--body "This PR syncs changes from migration-v2:\n${{ github.event.pull_request.html_url }}" \
206+
--head sync-from-migration-v2-${{ github.event.pull_request.number }} \
207+
--base ${{ env.BRANCH }}
208+
env:
209+
GH_TOKEN: ${{ secrets.GH_PAT }}

api/.DS_Store

6 KB
Binary file not shown.

api/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dist/
1717
# Mono auto generated files
1818
mono_crash.*
1919

20+
2021
# Build results
2122
[Dd]ebug/
2223
[Dd]ebugPublic/
@@ -358,6 +359,7 @@ combine.log
358359

359360

360361
!example.env
362+
!production.env
361363

362364
database/
363365
/sitecoreMigrationData

api/src/.DS_Store

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)