fix: Actions testing (#432)

* fix: Actions testing

* cr

* cr
This commit is contained in:
Brace Sproul 2025-07-16 12:09:16 -07:00 • committed by GitHub
parent 4a49eecd3c
commit 13329fe5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,8 +4,6 @@ on:
push:
branches:
- main
paths:
- 'apps/docs/**'
workflow_dispatch:
jobs:
@ -23,15 +21,15 @@ jobs:
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 "docs_found=true" >> $GITHUB_OUTPUT
echo "Found MDX files to sync"
else
echo "mdx_files_found=false" >> $GITHUB_OUTPUT
echo "docs_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'
if: steps.check-files.outputs.docs_found == 'true'
run: |
git clone https://x-access-token:${{ secrets.LANGCHAIN_DOCS_TOKEN }}@github.com/langchain-ai/docs.git langchain-docs
cd langchain-docs
@ -39,7 +37,7 @@ jobs:
git config user.email "openswe-bot@langchain.com"
- name: Create branch for documentation sync
if: steps.check-files.outputs.mdx_files_found == 'true'
if: steps.check-files.outputs.docs_found == 'true'
run: |
cd langchain-docs
BRANCH_NAME="sync-openswe-docs-$(date +%Y%m%d-%H%M%S)"
@ -47,27 +45,39 @@ jobs:
git checkout -b "$BRANCH_NAME"
- name: Prepare target directory
if: steps.check-files.outputs.mdx_files_found == 'true'
if: steps.check-files.outputs.docs_found == 'true'
run: |
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
if: steps.check-files.outputs.mdx_files_found == 'true'
if: steps.check-files.outputs.docs_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/ \;
# Copy all .mdx files from apps/docs to the target directory, preserving structure
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
echo "Copied files:"
ls -la langchain-docs/docs/src/labs/swe/
echo "Copied MDX files:"
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
if: steps.check-files.outputs.mdx_files_found == 'true'
if: steps.check-files.outputs.docs_found == 'true'
id: commit
run: |
cd langchain-docs
git add docs/src/labs/swe/
git add src/labs/swe/
if git diff --staged --quiet; then
echo "No changes to commit"
@ -82,7 +92,7 @@ jobs:
fi
- 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: |
cd langchain-docs
git push origin "$BRANCH_NAME"
@ -94,7 +104,7 @@ jobs:
**Changes:**
- Updated MDX files from \`apps/docs/\`
- Target directory: \`docs/src/labs/swe/\`
- Target directory: \`src/labs/swe/\`
- Source commit: ${{ github.sha }}
- Synced at $(date -u '+%Y-%m-%d %H:%M:%S UTC')