forked from LengKundee/MQL5-Google-Onedrive
3.3 KiB
3.3 KiB
Quick Configuration Guide for Repository Sync
This guide provides quick setup instructions for enabling repository synchronization between A6-9V/MQL5-Google-Onedrive and L6-N9.
Quick Start (5 Minutes)
Step 1: Generate GitHub Token
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Name it:
Repo Sync Token - Select scope: ✅ repo (Full control of private repositories)
- Click "Generate token"
- Copy the token (starts with
ghp_)
Step 2: Add to GitHub Secrets
# Using GitHub CLI (recommended)
gh secret set REPO_SYNC_TOKEN --body "ghp_YOUR_TOKEN_HERE"
# Or via Web UI:
# Settings → Secrets and variables → Actions → New repository secret
Step 3: Test the Sync
- Go to Actions tab in your repository
- Click Repository Sync with L6-N9
- Click Run workflow
- Select push direction
- Click Run workflow
- Watch the logs to verify success
Optional: REST API Integration
If you have a REST API endpoint that should receive sync notifications:
# Set API credentials
gh secret set REST_API_KEY --body "your_api_key_here"
gh secret set REST_API_URL --body "https://api.example.com/sync"
Optional: Custom Configuration
To change the target repository or branch:
# Custom repository (default: A6-9V/L6-N9)
gh secret set L6_N9_REPO --body "YourOrg/YourRepo"
# Custom branch (default: main)
gh secret set L6_N9_SYNC_BRANCH --body "develop"
Testing Locally
Test the sync manager on your local machine:
# 1. Create .env file
cp .env.example .env
# 2. Edit .env and add your token
nano .env # or use your preferred editor
# Add this line:
# REPO_SYNC_TOKEN=ghp_YOUR_TOKEN_HERE
# 3. Check configuration
python3 scripts/repo_sync_manager.py --check-config
# 4. Run a test sync (requires token and repo access)
# python3 scripts/repo_sync_manager.py --direction push
Automatic Syncing
Once configured, syncing happens automatically:
- ✅ Every 6 hours (scheduled)
- ✅ On push to main (automatic)
- ✅ Manual trigger (via Actions UI)
What Gets Synced
The sync copies these items to L6-N9:
- 📁
mt5/MQL5/- Indicators and Expert Advisors - 📁
scripts/- Automation scripts - 📁
config/- Configuration files - 📁
docs/- Documentation - 📄
README.md,requirements.txt,.env.example
Troubleshooting
❌ "REPO_SYNC_TOKEN not configured"
Fix: Add the token to GitHub Secrets (see Step 2)
❌ "Repository not found"
Fix: Ensure the token has access to the L6-N9 repository
❌ "403 Forbidden"
Fix: Verify the token has repo scope
⚠️ REST API notification failed
Note: This is non-critical. Sync will continue even if API notification fails.
Need More Help?
Verification
After setup, verify the sync is working:
- Make a small change in your repository
- Commit and push to main branch
- Check Actions tab - sync should trigger automatically
- Verify changes appear in L6-N9 repository
Security Reminders
- 🔒 Never commit tokens to git
- 🔒 Store tokens in GitHub Secrets
- 🔒 Rotate tokens every 60-90 days
- 🔒 Use minimal required permissions
Ready to sync? Start with Step 1 above! 🚀