Sync Jaseci Docs #2
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 Jaseci Docs | |
| on: | |
| # Run every Monday at 00:00 UTC | |
| schedule: | |
| - cron: '0 0 * * 1' | |
| # 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: | | |
| git clone --depth 1 https://github.com/jaseci-labs/jaseci.git /tmp/jaseci | |
| - name: Remove old docs and copy new docs | |
| run: | | |
| # Remove old docs directory | |
| rm -rf jac-gpt/server/docs | |
| # Copy new docs directory | |
| cp -r /tmp/jaseci/docs/docs jac-gpt/server/docs | |
| echo "Docs synced successfully" | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git add jac-gpt/server/docs | |
| 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 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 "🔄 Weekly 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/server/docs/\` directory with the latest documentation | |
| ### 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] 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: Auto-merge Pull Request | |
| if: steps.check_changes.outputs.has_changes == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Enable auto-merge | |
| gh pr merge $PR_URL --auto --squash --delete-branch | |
| echo "✅ PR will be automatically merged once checks pass" | |
| - name: No changes summary | |
| if: steps.check_changes.outputs.has_changes == 'false' | |
| run: | | |
| echo "✅ Docs are already up to date. No PR created." |