forked from LengKundee/MQL5-Google-Onedrive
138 lines
3.3 KiB
Markdown
138 lines
3.3 KiB
Markdown
# 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
|
|
|
|
1. Go to https://github.com/settings/tokens
|
|
2. Click "Generate new token (classic)"
|
|
3. Name it: `Repo Sync Token`
|
|
4. Select scope: ✅ **repo** (Full control of private repositories)
|
|
5. Click "Generate token"
|
|
6. **Copy the token** (starts with `ghp_`)
|
|
|
|
### Step 2: Add to GitHub Secrets
|
|
|
|
```bash
|
|
# 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
|
|
|
|
1. Go to **Actions** tab in your repository
|
|
2. Click **Repository Sync with L6-N9**
|
|
3. Click **Run workflow**
|
|
4. Select **push** direction
|
|
5. Click **Run workflow**
|
|
6. Watch the logs to verify success
|
|
|
|
## Optional: REST API Integration
|
|
|
|
If you have a REST API endpoint that should receive sync notifications:
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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?
|
|
|
|
- 📖 [Full Setup Guide](REPO_SYNC_SETUP.md)
|
|
- 📖 [GitHub Secrets Setup](GITHUB_SECRETS_SETUP.md)
|
|
- 📖 [Main README](README.md)
|
|
|
|
## Verification
|
|
|
|
After setup, verify the sync is working:
|
|
|
|
1. Make a small change in your repository
|
|
2. Commit and push to main branch
|
|
3. Check Actions tab - sync should trigger automatically
|
|
4. 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! 🚀
|