tractatus/.github/workflows/sync-public-docs.yml
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

181 lines
5.8 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Sync Documentation to Public Repository
on:
push:
branches:
- main
paths:
- 'docs/case-studies/**/*.md'
- 'docs/research/**/*.md'
- 'README.md'
workflow_dispatch:
inputs:
skip_validation:
description: 'Skip security validation (USE WITH CAUTION)'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'
jobs:
validate-and-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Private Repository
uses: actions/checkout@v4
with:
path: tractatus-private
fetch-depth: 0
- name: Checkout Public Repository
uses: actions/checkout@v4
with:
repository: AgenticGovernance/tractatus-framework
token: ${{ secrets.PUBLIC_REPO_TOKEN }}
path: tractatus-public
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies
run: |
cd tractatus-private
npm ci
- name: Run Security Validation
if: github.event.inputs.skip_validation != 'true'
id: validation
run: |
cd tractatus-private
node scripts/validate-public-sync.js
env:
SYNC_MODE: github-actions
- name: Sync Case Studies
if: success()
run: |
# Create directory if it doesn't exist
mkdir -p tractatus-public/docs/case-studies
# Copy case studies (only if they exist and passed validation)
for file in tractatus-private/docs/case-studies/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "Syncing case study: $filename"
cp "$file" "tractatus-public/docs/case-studies/$filename"
fi
done
- name: Sync Research Topics
if: success()
run: |
# Create directory if it doesn't exist
mkdir -p tractatus-public/docs/research
# Copy research topics (only if they exist and passed validation)
for file in tractatus-private/docs/research/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "Syncing research topic: $filename"
cp "$file" "tractatus-public/docs/research/$filename"
fi
done
- name: Sync README (if sanitized)
if: success()
run: |
# Only sync README if it has been marked as sanitized
if grep -q "<!-- PUBLIC_REPO_SAFE -->" tractatus-private/README.md; then
echo "README marked as sanitized, syncing..."
cp tractatus-private/README.md tractatus-public/README.md
else
echo "README not marked as sanitized, skipping sync"
fi
- name: Configure Git
if: success()
run: |
cd tractatus-public
git config user.name "Tractatus Framework Bot"
git config user.email "noreply@agenticgovernance.org"
- name: Commit and Push Changes
if: success()
run: |
cd tractatus-public
# Check if there are changes
if [ -n "$(git status --porcelain)" ]; then
git add docs/case-studies/*.md docs/research/*.md README.md 2>/dev/null || true
# Get commit message from private repo
COMMIT_MSG=$(cd ../tractatus-private && git log -1 --pretty=%B)
git commit -m "docs: sync from private repo" -m "Original commit: $COMMIT_MSG" -m "Automated sync from private repository" -m "Validated by: scripts/validate-public-sync.js"
git push origin main
echo "✅ Changes synced successfully"
else
echo " No changes to sync"
fi
- name: Create Sync Report
if: always()
run: |
cd tractatus-private
# Set validation status
VALIDATION_STATUS="${{ steps.validation.outcome }}"
if [ -z "$VALIDATION_STATUS" ]; then
VALIDATION_STATUS="skipped"
fi
# Generate sync report
echo "# Sync Report - $(date -u +%Y-%m-%d)" > sync-report.md
echo "" >> sync-report.md
echo "## Validation Status" >> sync-report.md
echo "- Security Validation: $VALIDATION_STATUS" >> sync-report.md
echo "- Files Synced: $(cd ../tractatus-public && git diff --cached --name-only 2>/dev/null | wc -l)" >> sync-report.md
echo "" >> sync-report.md
echo "## Changed Files" >> sync-report.md
cd ../tractatus-public
git diff --cached --name-only >> ../tractatus-private/sync-report.md 2>/dev/null || echo "No changes" >> ../tractatus-private/sync-report.md
- name: Upload Sync Report
if: always()
uses: actions/upload-artifact@v4
with:
name: sync-report
path: tractatus-private/sync-report.md
retention-days: 30
notify-failure:
runs-on: ubuntu-latest
needs: validate-and-sync
if: failure()
permissions:
issues: write
steps:
- name: Create Issue on Failure
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: 'AgenticGovernance',
repo: 'tractatus',
title: '🚨 Public Docs Sync Failed',
body: `The automated sync to public repository failed.
**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
**Commit:** ${{ github.sha }}
**Branch:** ${{ github.ref }}
Please review the workflow logs and validation report.`,
labels: ['automation', 'sync-failure']
})