Skip to content

Commit 9281f14

Browse files
chitcommitclaude
andcommitted
Add sync workflows and Notion export infrastructure
- Add 3 sync workflows: services, deployments, integrations (daily cron + manual dispatch, matching CHITTYOS pattern) - Create export_bundles.py: real Notion-to-CSV exporter with pagination, property flattening, manifest generation, dry-run - Create preflight.py: pre-export validation (token, config, dirs) - Create verify_bundle.py: post-export integrity checks (manifest, CSV row counts, schema version, ChittyID compliance) - Add chittyos-export.yaml config with 3 bundle definitions (database URLs are TODO placeholders until Notion DBs are created) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6844f22 commit 9281f14

7 files changed

Lines changed: 955 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Sync Deployment Log
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 3 AM UTC
13+
- cron: '0 3 * * *'
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
sync-deployments:
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 deployments
45+
46+
- name: Dry-run export
47+
env:
48+
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
49+
CHITTY_ID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }}
50+
run: |
51+
echo "Running dry-run to validate export..."
52+
python scripts/export_bundles.py deployments --dry-run
53+
54+
- name: Export deployments bundle
55+
env:
56+
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
57+
CHITTY_ID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }}
58+
run: |
59+
python scripts/export_bundles.py deployments
60+
61+
- name: Verify bundle
62+
run: |
63+
python scripts/verify_bundle.py deployments
64+
65+
- name: Check for changes
66+
id: git_status
67+
run: |
68+
git diff --exit-code packages/deployments/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/deployments/
76+
git commit -m "sync(deployments): automated export $(date +%Y-%m-%d)
77+
78+
Bundle: deployments
79+
Exported by: ${{ github.actor }}
80+
ChittyID: ${{ vars.CHITTY_ID || 'deployments-sync-workflow' }}
81+
Workflow: ${{ github.workflow }}"
82+
git push
83+
84+
- name: Summary
85+
if: always()
86+
run: |
87+
echo "## Deployments Bundle Sync" >> $GITHUB_STEP_SUMMARY
88+
echo "" >> $GITHUB_STEP_SUMMARY
89+
echo "**Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
90+
echo "**Bundle:** deployments" >> $GITHUB_STEP_SUMMARY
91+
echo "**ChittyID:** ${{ vars.CHITTY_ID || 'deployments-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/deployments/manifest.json ]; then
95+
echo "### Manifest" >> $GITHUB_STEP_SUMMARY
96+
echo '```json' >> $GITHUB_STEP_SUMMARY
97+
cat packages/deployments/manifest.json >> $GITHUB_STEP_SUMMARY
98+
echo '```' >> $GITHUB_STEP_SUMMARY
99+
fi
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Sync Services Registry
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 2 AM UTC
13+
- cron: '0 2 * * *'
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
sync-services:
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 services
45+
46+
- name: Dry-run export
47+
env:
48+
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
49+
CHITTY_ID: ${{ vars.CHITTY_ID || 'services-sync-workflow' }}
50+
run: |
51+
echo "Running dry-run to validate export..."
52+
python scripts/export_bundles.py services --dry-run
53+
54+
- name: Export services bundle
55+
env:
56+
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
57+
CHITTY_ID: ${{ vars.CHITTY_ID || 'services-sync-workflow' }}
58+
run: |
59+
python scripts/export_bundles.py services
60+
61+
- name: Verify bundle
62+
run: |
63+
python scripts/verify_bundle.py services
64+
65+
- name: Check for changes
66+
id: git_status
67+
run: |
68+
git diff --exit-code packages/services/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/services/
76+
git commit -m "sync(services): automated export $(date +%Y-%m-%d)
77+
78+
Bundle: services
79+
Exported by: ${{ github.actor }}
80+
ChittyID: ${{ vars.CHITTY_ID || 'services-sync-workflow' }}
81+
Workflow: ${{ github.workflow }}"
82+
git push
83+
84+
- name: Summary
85+
if: always()
86+
run: |
87+
echo "## Services Bundle Sync" >> $GITHUB_STEP_SUMMARY
88+
echo "" >> $GITHUB_STEP_SUMMARY
89+
echo "**Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
90+
echo "**Bundle:** services" >> $GITHUB_STEP_SUMMARY
91+
echo "**ChittyID:** ${{ vars.CHITTY_ID || 'services-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/services/manifest.json ]; then
95+
echo "### Manifest" >> $GITHUB_STEP_SUMMARY
96+
echo '```json' >> $GITHUB_STEP_SUMMARY
97+
cat packages/services/manifest.json >> $GITHUB_STEP_SUMMARY
98+
echo '```' >> $GITHUB_STEP_SUMMARY
99+
fi

chittyos-export.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ChittyApps Bundle Export Configuration
2+
# Defines Notion databases to export as CSV bundles for version-controlled data snapshots.
3+
#
4+
# Usage:
5+
# python scripts/export_bundles.py <bundle_key> [--dry-run]
6+
# python scripts/preflight.py --bundle <bundle_key>
7+
# python scripts/verify_bundle.py <bundle_key>
8+
#
9+
# Prerequisites:
10+
# - NOTION_TOKEN env var set (org secret)
11+
# - pip install notion-client pyyaml
12+
13+
defaults:
14+
output_root: packages
15+
manifest_filename: manifest.json
16+
format: csv
17+
18+
export_bundles:
19+
services:
20+
name: "ChittyApps Service Registry"
21+
schema_version: "1.0.0"
22+
description: "Service catalog, health status, and deployment metadata for all chittyapps repos"
23+
databases:
24+
- key: service_catalog
25+
notion_url: "TODO: paste Notion service catalog DB URL"
26+
description: "Master list of all chittyapps services with status, owner, tier"
27+
- key: health_checks
28+
notion_url: "TODO: paste Notion health checks DB URL"
29+
description: "Health endpoint registry and monitoring results"
30+
31+
deployments:
32+
name: "ChittyApps Deployment Log"
33+
schema_version: "1.0.0"
34+
description: "Deployment history, versions, and rollback records"
35+
databases:
36+
- key: deployment_log
37+
notion_url: "TODO: paste Notion deployment log DB URL"
38+
description: "Historical deployment records per service"
39+
- key: environments
40+
notion_url: "TODO: paste Notion environments DB URL"
41+
description: "Environment configurations (dev, staging, production)"
42+
43+
integrations:
44+
name: "ChittyApps Integration Map"
45+
schema_version: "1.0.0"
46+
description: "Service-to-service connections, API dependencies, and external integrations"
47+
databases:
48+
- key: integration_map
49+
notion_url: "TODO: paste Notion integration map DB URL"
50+
description: "Inter-service dependency graph"
51+
- key: api_registry
52+
notion_url: "TODO: paste Notion API registry DB URL"
53+
description: "API endpoints, versions, and deprecation status"

0 commit comments

Comments
 (0)