Skip to content

Commit

Permalink
Automated commit by sync script
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoabeltran16 committed Jul 27, 2024
1 parent 1face90 commit c11249a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
16 changes: 12 additions & 4 deletions project-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -794,14 +794,22 @@ The provided scripts incorporate good practices, including error handling, debug

### **When to Use Each Script**
**sync_repos.sh**
- **Purpose:** Orchestrates the syncing of all branches listed in the script.
- **Use Case:** Run this script when you want to perform a full sync of all relevant branches (main, develop, feature branches, etc.) between GitHub and GitLab.
- **Frequency:** Use this regularly, such as at the end of each development cycle or before major releases.
- **Comand:**
1. For updating all default branches
Run the sync_repos.sh script without any arguments to update all default branches:

```
./sync_repos.sh
```

2. For updating specific branches:
Pass the branch names as arguments to the sync_repos.sh script to update specific branches:

```
./sync_repos.sh feature/bot-initialization feature/database-setup
```

**sync_branch.sh**
- **Purpose:** Syncs a single specified branch.
- **Use Case:** Use this script when you need to sync a specific branch, for example, if you’ve made changes to one particular branch and want to ensure it’s up-to-date across both repositories.
Expand Down
2 changes: 1 addition & 1 deletion sync_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# Checkout the branch
echo "Checking out branch $branch..."
git checkout "$branch" || { echo "Failed to checkout branch $branch"; exit 1; }
git checkout -b $branch main || git checkout $branch

# Merge changes from GitHub to GitLab
echo "Merging changes from GitHub to GitLab for branch $branch..."
Expand Down
11 changes: 6 additions & 5 deletions sync_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ if ! git diff-index --quiet HEAD --; then
git commit -m "Automated commit by sync script"
fi

# Branches to create and push
branches=("feature/cycle-1-setup" "feature/bot-initialization" "feature/database-setup" "feature/basic-term-lookup" "feature/env-configuration")
# Define default branches to create and push if no specific branches are provided
default_branches=("feature/cycle-1-setup" "feature/bot-initialization" "feature/database-setup" "feature/basic-term-lookup" "feature/env-configuration")

# Use provided branches or default branches if none are provided
branches=("${@:-${default_branches[@]}}")

# Create and push branches
for branch in "${branches[@]}"; do
git checkout -b $branch main || git checkout $branch
git push -u github $branch
git push -u gitlab $branch
./sync_branch.sh "$branch"
done

# Merge changes from GitHub to GitLab
Expand Down

0 comments on commit c11249a

Please sign in to comment.