Skip to content

Commit 0892dfa

Browse files
committed
workflow changes
1 parent f6ee0e9 commit 0892dfa

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

.github/workflows/repo-sync.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ on:
66
branches:
77
- dev # Change this to your default branch if needed
88

9+
env:
10+
BRANCH : dev # Change this to your default branch if needed
11+
SITECORE_REPO: contentstack-expert-services/migration-tool-sitecore
12+
CONTENTFUL_REPO: contentstack-expert-services/migration-tool-contentful
13+
WORDPRESS_REPO: contentstack-expert-services/migration-tool-wordpress
14+
RSYNC_SITECORE_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts/' --exclude 'src/services/wordpress.service.ts/'" # Exclude contentful and wordpress services
15+
RSYNC_CONTENTFUL_EXCLUDES: "--exclude 'src/services/wordpress.service.ts/' --exclude 'src/services/sitecore.service.ts/'" # Exclude wordpress and sitecore services
16+
RSYNC_WORDPRESS_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts/' --exclude 'src/services/sitecore.service.ts/'" # Exclude contentful and sitecore services
17+
918
jobs:
1019
sync-on-merge:
1120
runs-on: ubuntu-latest
@@ -51,6 +60,10 @@ jobs:
5160
- 'upload-api/migration-sitecore/**'
5261
migration-contentful:
5362
- 'upload-api/migration-contentful/**'
63+
migration-wordpress:
64+
- 'upload-api/migration-wordpress/**'
65+
index:
66+
- 'index.js'
5467
5568
- name: Setup Git
5669
if: env.merged == 'true'
@@ -59,12 +72,21 @@ jobs:
5972
git config --global user.email "[email protected]"
6073
6174
- name: Sync changes to sitecore-repo (if applicable)
62-
if: env.merged == 'true' && (steps.file_changes.outputs.api == 'true' || steps.file_changes.outputs.cli == 'true' || steps.file_changes.outputs.ui == 'true' || steps.file_changes.outputs.upload-api == 'true' || steps.file_changes.outputs.migration-sitecore == 'true')
75+
if: |
76+
env.merged == 'true' &&
77+
(
78+
steps.file_changes.outputs.api == 'true' ||
79+
steps.file_changes.outputs.cli == 'true' ||
80+
steps.file_changes.outputs.ui == 'true' ||
81+
steps.file_changes.outputs.upload-api == 'true' ||
82+
steps.file_changes.outputs.migration-sitecore == 'true' ||
83+
steps.file_changes.outputs.index == 'true'
84+
)
6385
run: |
64-
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/contentstack-expert-services/migration-tool-sitecore.git
86+
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ env.SITECORE_REPO }}.git
6587
cd migration-tool-sitecore
6688
git checkout -b sync-from-migration-v2-${{ github.event.pull_request.number }}
67-
rsync -av --delete ../api/ ./api/
89+
rsync -av --delete $RSYNC_SITECORE_EXCLUDES ../api/ ./api/
6890
rsync -av --delete ../cli/ ./cli/
6991
rsync -av --delete ../ui/ ./ui/
7092
rsync -av --delete ../upload-api/src ./upload-api/src
@@ -74,12 +96,21 @@ jobs:
7496
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
7597
7698
- name: Create PR in sitecore-repo
77-
if: env.merged == 'true' && (steps.file_changes.outputs.api == 'true' || steps.file_changes.outputs.cli == 'true' || steps.file_changes.outputs.ui == 'true' || steps.file_changes.outputs.upload-api == 'true' || steps.file_changes.outputs.migration-sitecore == 'true')
99+
if: |
100+
env.merged == 'true' &&
101+
(
102+
steps.file_changes.outputs.api == 'true' ||
103+
steps.file_changes.outputs.cli == 'true' ||
104+
steps.file_changes.outputs.ui == 'true' ||
105+
steps.file_changes.outputs.upload-api == 'true' ||
106+
steps.file_changes.outputs.migration-sitecore == 'true' ||
107+
steps.file_changes.outputs.index == 'true'
108+
)
78109
run: |
79-
gh pr create --repo contentstack-expert-services/migration-tool-sitecore \
110+
gh pr create --repo ${{ env.SITECORE_REPO }} \
80111
--title "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}" \
81112
--body "This PR syncs changes from migration-v2:\n${{ github.event.pull_request.html_url }}" \
82113
--head sync-from-migration-v2-${{ github.event.pull_request.number }} \
83-
--base main
114+
--base ${{ env.BRANCH }}
84115
env:
85116
GH_TOKEN: ${{ secrets.GH_PAT }}

0 commit comments

Comments
 (0)