Sync Deployment Log #1
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: Sync Deployment Log | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| skip_preflight: | |
| description: 'Skip preflight checks (not recommended)' | |
| required: false | |
| type: boolean | |
| default: false | |
| schedule: | |
| # Run daily at 3 AM UTC | |
| - cron: '0 3 * * *' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync-deployments: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install notion-client pyyaml | |
| - name: Preflight checks | |
| if: ${{ !inputs.skip_preflight }} | |
| env: | |
| NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
| run: | | |
| python scripts/preflight.py --bundle deployments | |
| - name: Dry-run export | |
| env: | |
| NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
| CHITTY_ID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }} | |
| run: | | |
| echo "Running dry-run to validate export..." | |
| python scripts/export_bundles.py deployments --dry-run | |
| - name: Export deployments bundle | |
| env: | |
| NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
| CHITTY_ID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }} | |
| run: | | |
| python scripts/export_bundles.py deployments | |
| - name: Verify bundle | |
| run: | | |
| python scripts/verify_bundle.py deployments | |
| - name: Check for changes | |
| id: git_status | |
| run: | | |
| git diff --exit-code packages/deployments/data/ || echo "has_changes=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push | |
| if: steps.git_status.outputs.has_changes == 'true' | |
| run: | | |
| git config user.name "chittyapps-bot" | |
| git config user.email "bot@users.noreply.github.com" | |
| git add packages/deployments/ | |
| git commit -m "sync(deployments): automated export $(date +%Y-%m-%d) | |
| Bundle: deployments | |
| Exported by: ${{ github.actor }} | |
| ChittyID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }} | |
| Workflow: ${{ github.workflow }}" | |
| git push | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "## Deployments Bundle Sync" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Bundle:** deployments" >> $GITHUB_STEP_SUMMARY | |
| echo "**ChittyID:** ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Changes:** ${{ steps.git_status.outputs.has_changes || 'none' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f packages/deployments/manifest.json ]; then | |
| echo "### Manifest" >> $GITHUB_STEP_SUMMARY | |
| echo '```json' >> $GITHUB_STEP_SUMMARY | |
| cat packages/deployments/manifest.json >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fi |