|
| 1 | +name: Sync Integration Map |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + skip_preflight: |
| 7 | + description: 'Skip preflight checks (not recommended)' |
| 8 | + required: false |
| 9 | + type: boolean |
| 10 | + default: false |
| 11 | + schedule: |
| 12 | + # Run daily at 4 AM UTC |
| 13 | + - cron: '0 4 * * *' |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + pull-requests: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + sync-integrations: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 15 |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Python |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: '3.11' |
| 32 | + cache: 'pip' |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + pip install notion-client pyyaml |
| 38 | +
|
| 39 | + - name: Preflight checks |
| 40 | + if: ${{ !inputs.skip_preflight }} |
| 41 | + env: |
| 42 | + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} |
| 43 | + run: | |
| 44 | + python scripts/preflight.py --bundle integrations |
| 45 | +
|
| 46 | + - name: Dry-run export |
| 47 | + env: |
| 48 | + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} |
| 49 | + CHITTY_ID: ${{ vars.CHITTY_ID || 'integrations-sync-workflow' }} |
| 50 | + run: | |
| 51 | + echo "Running dry-run to validate export..." |
| 52 | + python scripts/export_bundles.py integrations --dry-run |
| 53 | +
|
| 54 | + - name: Export integrations bundle |
| 55 | + env: |
| 56 | + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} |
| 57 | + CHITTY_ID: ${{ vars.CHITTY_ID || 'integrations-sync-workflow' }} |
| 58 | + run: | |
| 59 | + python scripts/export_bundles.py integrations |
| 60 | +
|
| 61 | + - name: Verify bundle |
| 62 | + run: | |
| 63 | + python scripts/verify_bundle.py integrations |
| 64 | +
|
| 65 | + - name: Check for changes |
| 66 | + id: git_status |
| 67 | + run: | |
| 68 | + git diff --exit-code packages/integrations/data/ || echo "has_changes=true" >> $GITHUB_OUTPUT |
| 69 | +
|
| 70 | + - name: Commit and push |
| 71 | + if: steps.git_status.outputs.has_changes == 'true' |
| 72 | + run: | |
| 73 | + git config user.name "chittyapps-bot" |
| 74 | + git config user.email "bot@users.noreply.github.com" |
| 75 | + git add packages/integrations/ |
| 76 | + git commit -m "sync(integrations): automated export $(date +%Y-%m-%d) |
| 77 | +
|
| 78 | + Bundle: integrations |
| 79 | + Exported by: ${{ github.actor }} |
| 80 | + ChittyID: ${{ vars.CHITTY_ID || 'integrations-sync-workflow' }} |
| 81 | + Workflow: ${{ github.workflow }}" |
| 82 | + git push |
| 83 | +
|
| 84 | + - name: Summary |
| 85 | + if: always() |
| 86 | + run: | |
| 87 | + echo "## Integrations Bundle Sync" >> $GITHUB_STEP_SUMMARY |
| 88 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 89 | + echo "**Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY |
| 90 | + echo "**Bundle:** integrations" >> $GITHUB_STEP_SUMMARY |
| 91 | + echo "**ChittyID:** ${{ vars.CHITTY_ID || 'integrations-sync-workflow' }}" >> $GITHUB_STEP_SUMMARY |
| 92 | + echo "**Changes:** ${{ steps.git_status.outputs.has_changes || 'none' }}" >> $GITHUB_STEP_SUMMARY |
| 93 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 94 | + if [ -f packages/integrations/manifest.json ]; then |
| 95 | + echo "### Manifest" >> $GITHUB_STEP_SUMMARY |
| 96 | + echo '```json' >> $GITHUB_STEP_SUMMARY |
| 97 | + cat packages/integrations/manifest.json >> $GITHUB_STEP_SUMMARY |
| 98 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 99 | + fi |
0 commit comments