Orchestrator Auto #158
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Orchestrator Auto | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "17 8 * * *" # 08:17 UTC daily (03:17 America/Detroit) - auto mode | |
| - cron: "47 20 * * *" # 20:47 UTC daily (15:47 America/Detroit) - auto mode | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| scrape: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Checkout existing data | |
| run: | | |
| git fetch origin data:data 2>/dev/null || true | |
| if git show-ref --verify --quiet refs/heads/data; then | |
| git checkout data -- data/ 2>/dev/null || true | |
| git checkout dev | |
| fi | |
| - name: Check and update PO ranges | |
| run: | | |
| # Run monitor to check if updates are needed | |
| node scripts/monitor-po-ranges.js --update | |
| # Check if any configs were modified | |
| if git diff --quiet config/; then | |
| echo "No config updates needed" | |
| else | |
| echo "Config files were updated:" | |
| git diff --name-only config/ | |
| # Commit all config changes | |
| git add config/ | |
| git commit -m "🤖 Auto-update pipeline configurations | |
| $(git diff --cached --name-only config/ | sed 's/^/ - /') | |
| 🤖 Generated with GitHub Actions | |
| Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
| git push origin dev | |
| fi | |
| - name: Run full pipeline | |
| env: | |
| DATA_ROOT: ${{ github.workspace }}/data | |
| ORCH_CONCURRENCY: 2 | |
| ORCH_RETRIES: 2 | |
| GITHUB_SHA: ${{ github.sha }} | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| run: | | |
| pnpm run pipeline | |
| - name: Upload data artifact | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scraped-data | |
| path: data/** | |
| retention-days: 1 | |
| commit: | |
| needs: scrape | |
| runs-on: ubuntu-latest | |
| if: success() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| fetch-depth: 0 | |
| - name: Download data artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scraped-data | |
| path: data/ | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Commit and push data | |
| run: | | |
| # Switch to data branch (create if doesn't exist) | |
| git fetch origin data:data 2>/dev/null || git checkout -b data | |
| git checkout data | |
| # Add and commit data | |
| git add -f data/ | |
| if git diff --staged --quiet; then | |
| echo "No data changes to commit" | |
| else | |
| git commit -m "🤖 Auto-pipeline $(date -u '+%Y-%m-%d %H:%M UTC') | |
| Pipeline: Scrape → Bronze → Silver | |
| Orchestration ID: $(cat data/orchestrations/*/*/manifest.json 2>/dev/null | jq -r '.orchestration.id' 2>/dev/null | tail -1 || echo "N/A") | |
| 🤖 Generated with GitHub Actions | |
| Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
| # Push to data branch | |
| git push -u origin data | |
| fi |