MQL5-Google-Onedrive/.github/workflows/github-pages-sync.yml
google-labs-jules[bot] fb5d048638 Bolt: Optimize EA performance and fix CI runner acquisition
MQL5 Optimizations:
- Consolidate trade counting and profit calculation into a single history scan in `UpdateDailyStatistics()`.
- Optimize `IsTradingAllowed()` with fast math for hour extraction, replacing expensive `TimeToStruct()`.
- Reduce terminal API calls in `CheckDailyLimits()` by caching account balance.
- Reuse `TimeCurrent()` value in `OnTick()` and pass to sub-functions.

CI Fixes:
- Transition all workflows from `ubuntu-latest` to `self-hosted` runners.
- This resolves the "Runner of type hosted not acquired" failure by utilizing the repository's configured self-hosted infrastructure.

Impact: Measurably faster execution in MT5 'hot paths' and restored CI/CD functionality.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-02 20:58:25 +00:00

90 lines
2.6 KiB
YAML

name: Sync to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'mt5/MQL5/**'
- 'docs/**'
- 'README.md'
- '.github/workflows/github-pages-sync.yml'
permissions:
contents: write
concurrency:
group: github-pages-sync-main
cancel-in-progress: false
jobs:
sync-to-pages:
runs-on: self-hosted
env:
PAGES_REPO: Mouy-leng/-LengKundee-mql5.github.io.git
PAGES_BRANCH: main
steps:
- name: Checkout main repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check GitHub Pages sync configuration
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
echo "PAGES_SYNC_ENABLED=false" >> "$GITHUB_ENV"
echo "Skipping GitHub Pages sync: GITHUB_TOKEN not available."
exit 0
fi
echo "PAGES_SYNC_ENABLED=true" >> "$GITHUB_ENV"
- name: Setup Git
if: env.PAGES_SYNC_ENABLED == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Clone GitHub Pages repository
if: env.PAGES_SYNC_ENABLED == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clone https://${GITHUB_TOKEN}@github.com/${PAGES_REPO} pages-repo
cd pages-repo
git checkout ${PAGES_BRANCH} || git checkout -b ${PAGES_BRANCH}
- name: Sync MQL5 files to GitHub Pages
if: env.PAGES_SYNC_ENABLED == 'true'
run: |
# Copy MQL5 files
mkdir -p pages-repo/mql5
cp -r mt5/MQL5/* pages-repo/mql5/ || true
# Copy documentation
mkdir -p pages-repo/docs
cp -r docs/* pages-repo/docs/ || true
# Copy README if it exists
cp README.md pages-repo/ || true
- name: Commit and push to GitHub Pages
if: env.PAGES_SYNC_ENABLED == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd pages-repo
git add -A
git diff --staged --quiet || {
git commit -m "Auto-sync from MQL5-Google-Onedrive: $(date +'%Y-%m-%d %H:%M:%S')"
git push https://${GITHUB_TOKEN}@github.com/${PAGES_REPO} ${PAGES_BRANCH}
}
- name: Summary
if: env.PAGES_SYNC_ENABLED == 'true'
run: |
echo "✅ Successfully synced to GitHub Pages repository"
echo "Repository: https://github.com/${PAGES_REPO}"
echo "Branch: ${PAGES_BRANCH}"