mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-06 14:42:11 +00:00
parent
4a49eecd3c
commit
13329fe5c1
1 changed files with 27 additions and 17 deletions
44
.github/workflows/sync-docs.yml
vendored
44
.github/workflows/sync-docs.yml
vendored
|
|
@ -4,8 +4,6 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
|
||||||
- 'apps/docs/**'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -23,15 +21,15 @@ jobs:
|
||||||
id: check-files
|
id: check-files
|
||||||
run: |
|
run: |
|
||||||
if find apps/docs -name "*.mdx" -type f | head -1 | grep -q .; then
|
if find apps/docs -name "*.mdx" -type f | head -1 | grep -q .; then
|
||||||
echo "mdx_files_found=true" >> $GITHUB_OUTPUT
|
echo "docs_found=true" >> $GITHUB_OUTPUT
|
||||||
echo "Found MDX files to sync"
|
echo "Found MDX files to sync"
|
||||||
else
|
else
|
||||||
echo "mdx_files_found=false" >> $GITHUB_OUTPUT
|
echo "docs_found=false" >> $GITHUB_OUTPUT
|
||||||
echo "No MDX files found in apps/docs"
|
echo "No MDX files found in apps/docs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Clone LangChain docs repository
|
- name: Clone LangChain docs repository
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true'
|
if: steps.check-files.outputs.docs_found == 'true'
|
||||||
run: |
|
run: |
|
||||||
git clone https://x-access-token:${{ secrets.LANGCHAIN_DOCS_TOKEN }}@github.com/langchain-ai/docs.git langchain-docs
|
git clone https://x-access-token:${{ secrets.LANGCHAIN_DOCS_TOKEN }}@github.com/langchain-ai/docs.git langchain-docs
|
||||||
cd langchain-docs
|
cd langchain-docs
|
||||||
|
|
@ -39,7 +37,7 @@ jobs:
|
||||||
git config user.email "openswe-bot@langchain.com"
|
git config user.email "openswe-bot@langchain.com"
|
||||||
|
|
||||||
- name: Create branch for documentation sync
|
- name: Create branch for documentation sync
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true'
|
if: steps.check-files.outputs.docs_found == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd langchain-docs
|
cd langchain-docs
|
||||||
BRANCH_NAME="sync-openswe-docs-$(date +%Y%m%d-%H%M%S)"
|
BRANCH_NAME="sync-openswe-docs-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
|
@ -47,27 +45,39 @@ jobs:
|
||||||
git checkout -b "$BRANCH_NAME"
|
git checkout -b "$BRANCH_NAME"
|
||||||
|
|
||||||
- name: Prepare target directory
|
- name: Prepare target directory
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true'
|
if: steps.check-files.outputs.docs_found == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd langchain-docs
|
cd langchain-docs
|
||||||
mkdir -p docs/src/labs/swe
|
# Remove existing content to ensure clean sync
|
||||||
|
rm -rf src/labs/swe
|
||||||
|
mkdir -p src/labs/swe
|
||||||
|
|
||||||
- name: Copy MDX files to LangChain docs
|
- name: Copy MDX files to LangChain docs
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true'
|
if: steps.check-files.outputs.docs_found == 'true'
|
||||||
run: |
|
run: |
|
||||||
# Find and copy all .mdx files from apps/docs to the target directory
|
# Copy all .mdx files from apps/docs to the target directory, preserving structure
|
||||||
find apps/docs -name "*.mdx" -type f -exec cp {} langchain-docs/docs/src/labs/swe/ \;
|
find apps/docs -name "*.mdx" -type f | while read file; do
|
||||||
|
# Get the relative path from apps/docs
|
||||||
|
rel_path="${file#apps/docs/}"
|
||||||
|
# Create the directory structure in target
|
||||||
|
target_dir="langchain-docs/src/labs/swe/$(dirname "$rel_path")"
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
# Copy the file
|
||||||
|
cp "$file" "langchain-docs/src/labs/swe/$rel_path"
|
||||||
|
done
|
||||||
|
|
||||||
# List copied files for verification
|
# List copied files for verification
|
||||||
echo "Copied files:"
|
echo "Copied MDX files:"
|
||||||
ls -la langchain-docs/docs/src/labs/swe/
|
find langchain-docs/src/labs/swe/ -name "*.mdx" -type f
|
||||||
|
echo "Directory structure:"
|
||||||
|
tree langchain-docs/src/labs/swe/ || find langchain-docs/src/labs/swe/ -type d
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true'
|
if: steps.check-files.outputs.docs_found == 'true'
|
||||||
id: commit
|
id: commit
|
||||||
run: |
|
run: |
|
||||||
cd langchain-docs
|
cd langchain-docs
|
||||||
git add docs/src/labs/swe/
|
git add src/labs/swe/
|
||||||
|
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
|
|
@ -82,7 +92,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push branch and create pull request
|
- name: Push branch and create pull request
|
||||||
if: steps.check-files.outputs.mdx_files_found == 'true' && steps.commit.outputs.has_changes == 'true'
|
if: steps.check-files.outputs.docs_found == 'true' && steps.commit.outputs.has_changes == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd langchain-docs
|
cd langchain-docs
|
||||||
git push origin "$BRANCH_NAME"
|
git push origin "$BRANCH_NAME"
|
||||||
|
|
@ -94,7 +104,7 @@ jobs:
|
||||||
|
|
||||||
**Changes:**
|
**Changes:**
|
||||||
- Updated MDX files from \`apps/docs/\`
|
- Updated MDX files from \`apps/docs/\`
|
||||||
- Target directory: \`docs/src/labs/swe/\`
|
- Target directory: \`src/labs/swe/\`
|
||||||
- Source commit: ${{ github.sha }}
|
- Source commit: ${{ github.sha }}
|
||||||
- Synced at $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
- Synced at $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue