mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-02 16:43:16 +00:00
feat: Auto doc sync (#428)
* feat: Auto doc sync * fix: drop concepts page
This commit is contained in:
parent
7e5a5a7947
commit
4a49eecd3c
3 changed files with 106 additions and 8 deletions
105
.github/workflows/sync-docs.yml
vendored
Normal file
105
.github/workflows/sync-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
name: Sync Documentation Files
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'apps/docs/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.modified, 'apps/docs/') || contains(github.event.head_commit.added, 'apps/docs/') || contains(github.event.head_commit.removed, 'apps/docs/')
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check for MDX files in apps/docs
|
||||||
|
id: check-files
|
||||||
|
run: |
|
||||||
|
if find apps/docs -name "*.mdx" -type f | head -1 | grep -q .; then
|
||||||
|
echo "mdx_files_found=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Found MDX files to sync"
|
||||||
|
else
|
||||||
|
echo "mdx_files_found=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "No MDX files found in apps/docs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Clone LangChain docs repository
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true'
|
||||||
|
run: |
|
||||||
|
git clone https://x-access-token:${{ secrets.LANGCHAIN_DOCS_TOKEN }}@github.com/langchain-ai/docs.git langchain-docs
|
||||||
|
cd langchain-docs
|
||||||
|
git config user.name "OpenSWE Bot"
|
||||||
|
git config user.email "openswe-bot@langchain.com"
|
||||||
|
|
||||||
|
- name: Create branch for documentation sync
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true'
|
||||||
|
run: |
|
||||||
|
cd langchain-docs
|
||||||
|
BRANCH_NAME="sync-openswe-docs-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
|
||||||
|
git checkout -b "$BRANCH_NAME"
|
||||||
|
|
||||||
|
- name: Prepare target directory
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true'
|
||||||
|
run: |
|
||||||
|
cd langchain-docs
|
||||||
|
mkdir -p docs/src/labs/swe
|
||||||
|
|
||||||
|
- name: Copy MDX files to LangChain docs
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true'
|
||||||
|
run: |
|
||||||
|
# Find and copy all .mdx files from apps/docs to the target directory
|
||||||
|
find apps/docs -name "*.mdx" -type f -exec cp {} langchain-docs/docs/src/labs/swe/ \;
|
||||||
|
|
||||||
|
# List copied files for verification
|
||||||
|
echo "Copied files:"
|
||||||
|
ls -la langchain-docs/docs/src/labs/swe/
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true'
|
||||||
|
id: commit
|
||||||
|
run: |
|
||||||
|
cd langchain-docs
|
||||||
|
git add docs/src/labs/swe/
|
||||||
|
|
||||||
|
if git diff --staged --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
git commit -m "Sync OpenSWE documentation files
|
||||||
|
|
||||||
|
- Updated MDX files from apps/docs/
|
||||||
|
- Synced at $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
||||||
|
- Source commit: ${{ github.sha }}"
|
||||||
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Push branch and create pull request
|
||||||
|
if: steps.check-files.outputs.mdx_files_found == 'true' && steps.commit.outputs.has_changes == 'true'
|
||||||
|
run: |
|
||||||
|
cd langchain-docs
|
||||||
|
git push origin "$BRANCH_NAME"
|
||||||
|
|
||||||
|
# Create pull request using GitHub CLI
|
||||||
|
gh pr create \
|
||||||
|
--title "Sync OpenSWE Documentation Files" \
|
||||||
|
--body "This PR syncs documentation files from the OpenSWE repository.
|
||||||
|
|
||||||
|
**Changes:**
|
||||||
|
- Updated MDX files from \`apps/docs/\`
|
||||||
|
- Target directory: \`docs/src/labs/swe/\`
|
||||||
|
- Source commit: ${{ github.sha }}
|
||||||
|
- Synced at $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
||||||
|
|
||||||
|
**Auto-generated by:** OpenSWE Documentation Sync Workflow" \
|
||||||
|
--head "$BRANCH_NAME" \
|
||||||
|
--base main
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.LANGCHAIN_DOCS_TOKEN }}
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
title: 'Concepts'
|
|
||||||
description: 'Conceptual Guide to the Open SWE agents'
|
|
||||||
---
|
|
||||||
|
|
||||||
(do NOT implement this page. i will do this later)
|
|
||||||
|
|
@ -16,8 +16,7 @@
|
||||||
{
|
{
|
||||||
"group": "Get Started",
|
"group": "Get Started",
|
||||||
"pages": [
|
"pages": [
|
||||||
"index",
|
"index"
|
||||||
"concepts"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue