Skip to content

Sync Jaseci Docs

Sync Jaseci Docs #154

name: Sync Jaseci Docs
on:
# Run daily at 00:00 UTC
schedule:
- cron: '0 0 * * *'
# Allow manual triggering
workflow_dispatch:
jobs:
sync-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Agentic-AI repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Create sync branch
run: |
BRANCH_NAME="sync-jaseci-docs-$(date +%Y%m%d-%H%M%S)"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
git checkout -b $BRANCH_NAME
- name: Clone jaseci repository
run: |
# Clone to Agentic-AI/jaseci/ for generate_doc_links.jac to find mkdocs.yml
git clone --depth 1 https://github.com/jaseci-labs/jaseci.git jaseci
- name: Remove old docs and copy new docs
run: |
# Remove old docs directory in jac-gpt-fullstack
rm -rf jac-gpt-fullstack/services/docs
# Copy new docs directory (the actual markdown files)
cp -r jaseci/docs/docs jac-gpt-fullstack/services/docs
echo "Docs synced to jac-gpt-fullstack/services/docs"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies for doc link generation
run: |
pip install --upgrade pip
pip install jaclang byllm sentence-transformers numpy pyyaml python-dotenv
- name: Generate documentation links with embeddings
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
cd jac-gpt-fullstack
jac run services/generate_doc_links.jac
echo "Generated all_section_links.json with embeddings"
- name: Check for changes
id: check_changes
run: |
git add jac-gpt-fullstack/services/docs
git add jac-gpt-fullstack/services/docs_links
if git diff --staged --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Changes detected"
fi
- name: Commit changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git commit -m "chore: sync docs from jaseci-labs/jaseci
Automated sync of documentation from jaseci-labs/jaseci repository.
- Updated jac-gpt-fullstack/services/docs with latest markdown files
- Regenerated all_section_links.json with semantic embeddings
Updated on: $(date -u +"%Y-%m-%d %H:%M:%S UTC")"
- name: Push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git push origin $BRANCH_NAME
- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_URL=$(gh pr create \
--title "🔄 Daily Docs Sync from jaseci-labs/jaseci" \
--body "## Automated Documentation Sync
This PR updates the Jaseci documentation from the [jaseci-labs/jaseci](https://github.com/jaseci-labs/jaseci) repository.
### Changes
- Updated \`jac-gpt-fullstack/services/docs/\` with latest markdown files
- Regenerated \`jac-gpt-fullstack/services/docs_links/all_section_links.json\` with semantic embeddings
### Source
- Repository: \`jaseci-labs/jaseci\`
- Path: \`docs/docs/\`
- Sync Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
### Review Checklist
- [x] Documentation synced from upstream
- [x] Doc links regenerated with embeddings
- [x] Automated merge enabled
---
*This PR was automatically created and will be auto-merged by the [Sync Jaseci Docs workflow](.github/workflows/sync-jaseci-docs.yml)*" \
--head $BRANCH_NAME \
--base main)
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
echo "Created PR: $PR_URL"
- name: Merge Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Merge the PR immediately
gh pr merge $PR_URL --squash --delete-branch
echo "✅ PR merged successfully and branch deleted"
- name: No changes summary
if: steps.check_changes.outputs.has_changes == 'false'
run: |
echo "✅ Docs are already up to date. No PR created."