-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplit_repo.sh
executable file
·154 lines (144 loc) · 6.11 KB
/
split_repo.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
rm -rf backend-website-TECH-10855 backend-monorepo-TECH-10855
git clone -b chore/TECH-10855_develop git@github.com:SROADev/backend-monorepo.git backend-website-TECH-10855
cd backend-website-TECH-10855 || exit 1
to_copy=(
".dockerignore"
".eslintrc.json"
".github/CODEOWNERS"
".github/actions/setup-node # Duplicated"
".github/actions/setup-ssh-tunnel # Duplicated"
".github/actions/ssm-parameter-to-env # Duplicated"
".github/actions/turbo-run/ # Duplicated"
".github/pull_request_template.md"
".github/workflows/ci-pr-close.yml"
".github/workflows/ci-pr-open.yml"
".github/workflows/ci-push.yml"
".github/workflows/dlq-alert.yml"
".github/workflows/lambda-terraform.yml"
".github/workflows/list-packages.yml # Duplicated"
".github/workflows/migration-sync.yml # Duplicated"
".github/workflows/release.yml # Duplicated"
".github/workflows/reusable-e2e-jest.yml # Duplicated"
".github/workflows/reusable-lint-and-test.yml # Duplicated"
".github/workflows/reusable-rds-backup-restore.yml # Duplicated"
".github/workflows/reusable-rds-create.yml # Duplicated"
".github/workflows/reusable-rds-remove.yml # Duplicated"
".github/workflows/reusable-rds-seed-migrate.yml # Duplicated"
".github/workflows/reusable-s3-remove.yml # Duplicated"
".github/workflows/reusable-serverless-deploy-app.yml # Duplicated"
".github/workflows/reusable-serverless-deploy.yml # Duplicated"
".github/workflows/reusable-serverless-remove.yml # Duplicated"
".github/workflows/reusable-website-deploy.yml # Duplicated"
".github/workflows/reusable-website-sync-deploy.yml # Duplicated"
".github/workflows/scripts/backup-script.sh # Duplicated"
".github/workflows/scripts/rename-script.sh # Duplicated"
".github/workflows/scripts/restore-script.sh # Duplicated"
".github/workflows/scripts/scrub-run.sh # Duplicated"
".github/workflows/scripts/sql/website_scrub.sql"
".github/workflows/secret-env-s3.yml # Duplicated"
".github/workflows/shared-non-prod-create-update-rds.yml # Duplicated"
".github/workflows/sync-assistance-alert.yml"
".github/workflows/sync-assistant-deploy-qa-nightly.yml"
".github/workflows/sync-assistant-deploy-qa.yml"
".github/workflows/sync-assistant-deploy-sit.yml"
".github/workflows/sync-assistant-deploy-stg.yml"
".github/workflows/sync-assistant-deploy-test.yml"
".github/workflows/sync-assistant-main.yml"
".github/workflows/tagging.yml"
".github/workflows/website-api-deploy-production.yml"
".github/workflows/website-api-deploy-qa.yml"
".github/workflows/website-api-deploy-sit.yml"
".github/workflows/website-api-deploy-stg.yml"
".github/workflows/website-api-main.yml"
".github/workflows/website-api-prod-create-update-rds.yml"
".github/workflows/website-api-qa-nightly.yml"
".github/workflows/website-api-sync-stg-hotfix-deploy.yml"
".gitignore"
".husky/"
".nvmrc"
".vscode/"
"README.md"
"jest.config.js"
"package-lock.json"
"package.json"
"packages/eslint-config-sroa-backend/ # Duplicated"
"packages/jest-config/ # Duplicated"
"packages/portal-api/portal-api/Dockerfile" # Have to do it then can refactor
"packages/portal-api/portal-api/docker-compose.yml" # Have to do it and then can refactor
"packages/sitelink-soap-server-mock/"
"packages/terraform/aurora-rds/README.md"
"packages/terraform/aurora-rds/website-db"
"packages/terraform/ecs/"
"packages/terraform/modules/ # Duplicated"
"packages/terraform/scripts/ # Duplicated"
"packages/tsconfig/ # Duplicated"
"packages/website-api-e2e/"
"packages/website-api/"
"packages/website-data-access-db/"
"packages/website-sync-assistant/"
"packages/website-util-graphql/"
"tsconfig.json"
"turbo.json"
)
# Run git filter-repo with the paths
git filter-repo $(printf -- '--path %s ' "${to_copy[@]// #*/}") || exit 1
tree -L2
npm ci || exit 1
npm run build || exit 1
npm run test || exit 1
# Repoint the repository to backend-website
git remote add origin git@github.com:SROADev/backend-monorepo.git
git remote set-url origin git@github.com:SROADev/backend-website.git || exit 1
# Define the branch name as an environment variable
BACKEND_WEBSITE_TARGET_BRANCH="chore/TECH-10855"
# Check if the develop branch exists and create it if it doesn't
if ! git show-ref --quiet refs/heads/"$BACKEND_WEBSITE_TARGET_BRANCH"; then
git branch "$BACKEND_WEBSITE_TARGET_BRANCH" || exit 1
fi
# Push the changes to the develop branch
git push --set-upstream origin "$BACKEND_WEBSITE_TARGET_BRANCH" || exit 1
cd ..
git clone -b chore/TECH-10855_portal_develop git@github.com:SROADev/backend-monorepo.git backend-monorepo-TECH-10855 || exit 1
cd backend-monorepo-TECH-10855 || exit 1
# List of paths to remove
to_delete=(
".github/workflows/scripts/sql/website_scrub.sql"
".github/workflows/dlq-alert.yml"
".github/workflows/lambda-terraform.yml"
".github/workflows/migration-sync.yml"
".github/workflows/sync-assistance-alert.yml"
".github/workflows/sync-assistant-deploy-qa.yml"
".github/workflows/sync-assistant-deploy-qa-nightly.yml"
".github/workflows/sync-assistant-deploy-sit.yml"
".github/workflows/sync-assistant-deploy-stg.yml"
".github/workflows/sync-assistant-deploy-test.yml"
".github/workflows/sync-assistant-main.yml"
".github/workflows/website-api-deploy-production.yml"
".github/workflows/website-api-deploy-qa.yml"
".github/workflows/website-api-deploy-sit.yml"
".github/workflows/website-api-deploy-stg.yml"
".github/workflows/website-api-main.yml"
".github/workflows/website-api-prod-create-update-rds.yml"
".github/workflows/website-api-qa-nightly.yml"
".github/workflows/website-api-sync-stg-hotfix-deploy.yml"
"packages/terraform/aurora-rds/website-db"
"packages/terraform/ecs/"
"packages/website-api/"
"packages/website-api-e2e/"
"packages/website-data-access-db/"
"packages/website-sync-assistant/"
"packages/website-util-graphql/"
"packages/sitelink-soap-server-mock/"
)
# Remove each path using git rm -rf
for path in "${to_delete[@]}"; do
git rm -rf "$path"
done
npm ci || exit 1
npm run build || exit 1
npm run lint || exit 1
npm run test || exit 1
# Commit the changes
git commit -m "chore: TECH-10885 script split"
git push chore/TECH-10855_portal_develop