Skip to content

Commit e7df2ba

Browse files
committed
feat: add environment variable for specifying codeowner team to migrate
1 parent 0d824c4 commit e7df2ba

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

monorepo-migration/migrate.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ check_command mvn
1919
# Configuration
2020
MONOREPO_URL="https://github.com/googleapis/google-cloud-java"
2121
SOURCE_REPO_URL="${SOURCE_REPO_URL:-https://github.com/googleapis/java-logging}"
22+
CODEOWNER="${CODEOWNER:-}"
2223

2324
# Derive names from URLs to avoid duplication
2425
SOURCE_REPO_NAME="${SOURCE_REPO_URL##*/}"
@@ -116,6 +117,17 @@ git read-tree --prefix="$SOURCE_REPO_NAME/" -u "$SOURCE_REPO_NAME/main"
116117
echo "Committing migration..."
117118
git commit -n --no-gpg-sign -m "chore($SOURCE_REPO_NAME): migrate $SOURCE_REPO_NAME into monorepo"
118119

120+
# 7.1 Update CODEOWNERS
121+
if [ -n "$CODEOWNER" ]; then
122+
echo "Updating .github/CODEOWNERS..."
123+
mkdir -p .github
124+
echo "/$SOURCE_REPO_NAME/ $CODEOWNER @googleapis/cloud-java-team-teamsync" >> .github/CODEOWNERS
125+
126+
echo "Committing CODEOWNERS update..."
127+
git add .github/CODEOWNERS
128+
git commit -n --no-gpg-sign -m "chore($SOURCE_REPO_NAME): add code owners for $SOURCE_REPO_NAME"
129+
fi
130+
119131
# 7.5 Migrate GitHub Actions workflows
120132
echo "Checking for GitHub Actions workflows..."
121133
if [ -d "$SOURCE_REPO_NAME/.github/workflows" ]; then

0 commit comments

Comments
 (0)