Sync Arena Configs #10
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
| # Sync Arena Configs from maDisplayTools | |
| # | |
| # This workflow fetches arena YAML configs from maDisplayTools and regenerates | |
| # js/arena-configs.js to keep the web tools in sync with the source of truth. | |
| # | |
| # Triggers: | |
| # - repository_dispatch: When maDisplayTools sends an event (requires PAT setup) | |
| # - schedule: Weekly on Sunday at midnight UTC | |
| # - workflow_dispatch: Manual trigger from GitHub Actions UI | |
| name: Sync Arena Configs | |
| on: | |
| repository_dispatch: | |
| types: [arena-configs-updated] | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC | |
| workflow_dispatch: # Manual trigger | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout webDisplayTools | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Create temp directory for configs | |
| run: mkdir -p temp_configs | |
| - name: Fetch arena configs from maDisplayTools | |
| run: | | |
| echo "Fetching config file list from maDisplayTools..." | |
| curl -sL https://api.github.com/repos/reiserlab/maDisplayTools/contents/configs/arenas \ | |
| | jq -r '.[] | select(.name | endswith(".yaml") or endswith(".yml")) | .download_url' \ | |
| > config_urls.txt | |
| echo "Found $(wc -l < config_urls.txt) config files" | |
| echo "Downloading configs..." | |
| while read url; do | |
| filename=$(basename "$url") | |
| echo " Downloading: $filename" | |
| curl -sL "$url" -o "temp_configs/$filename" | |
| done < config_urls.txt | |
| echo "Downloaded configs:" | |
| ls -la temp_configs/ | |
| - name: Generate arena-configs.js | |
| run: node scripts/generate-arena-configs.js temp_configs | |
| - name: Clean up temp files | |
| run: rm -rf temp_configs config_urls.txt | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet js/arena-configs.js; then | |
| echo "No changes detected in arena-configs.js" | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected in arena-configs.js" | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| git diff js/arena-configs.js | head -50 | |
| fi | |
| - name: Create Pull Request | |
| if: steps.changes.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: sync arena configs from maDisplayTools" | |
| title: "Update arena configs from maDisplayTools" | |
| body: | | |
| ## Automated Arena Config Sync | |
| This PR was automatically generated by the `sync-arena-configs` workflow. | |
| **Source:** `maDisplayTools/configs/arenas/` | |
| ### Changes | |
| The `js/arena-configs.js` file has been regenerated from the latest YAML configs in maDisplayTools. | |
| ### Review Checklist | |
| - [ ] Verify the config changes look correct | |
| - [ ] Test the arena editor and 3D viewer with the updated configs | |
| branch: auto/sync-arena-configs | |
| delete-branch: true | |
| labels: | | |
| automated | |
| configs | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then | |
| echo "### Arena Config Sync Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "A PR has been created with updated configs." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "### Arena Config Sync Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "No changes detected - configs are already up to date." >> $GITHUB_STEP_SUMMARY | |
| fi |