[Docs] Restore Linkcheck (#824)

Plus:
1. Improve docstrings of add_node
2. Update crosslinking of sqlite and aiosqlite docstrings
3. Fix a bunch of links so we can turn on strict validation
This commit is contained in:
William FH
2024-06-26 00:04:13 -07:00
committed by GitHub
parent c217e4a58d
commit feca5e1970
16 changed files with 369 additions and 266 deletions
+29 -18
View File
@@ -26,10 +26,10 @@ jobs:
- name: Check links in Markdown files
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
folder-path: 'examples/'
folder-path: "examples/"
check-modified-files-only: ${{ github.event_name != 'schedule' }}
file-path: './README.md'
config-file: './.markdown-link-check.config.json'
file-path: "./README.md"
config-file: "./.markdown-link-check.config.json"
notebook-link-check:
runs-on: ubuntu-latest
@@ -49,18 +49,29 @@ jobs:
poetry install --with docs
poetry run pip install -U pytest pytest-check-links langsmith langchain GitPython
# - name: Check links in notebooks
# env:
# LANGCHAIN_API_KEY: test
# run: |
# if [ "${{ github.event_name }}" != "schedule" ]; then
# git fetch origin main
# CHANGED_FILES=$(git diff --name-only origin/main | grep '\.ipynb$')
# if [ -n "$CHANGED_FILES" ]; then
# poetry run pytest -o python_files=non_python_only --check-links --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" $CHANGED_FILES
# else
# echo "No notebook files changed."
# fi
# else
# poetry run pytest -o python_files=non_python_only --check-links --ignore="*.py" -k .ipynb --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" ./examples
# fi
- name: Check links in notebooks
env:
LANGCHAIN_API_KEY: test
run: |
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ] || ([ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]); then
echo "Running link check on all notebooks in examples directory..."
poetry run pytest -v --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" --check-links examples
else
echo "Fetching changes from origin/main..."
git fetch origin main
echo "Checking for changed notebook files..."
CHANGED_FILES=$(git diff --name-only origin/main | grep '\.ipynb$' || true)
echo "Changed files: ${CHANGED_FILES}"
if [ -n "${CHANGED_FILES}" ]; then
echo "Running link check on changed notebook files..."
poetry run pytest -v --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" --check-links ${CHANGED_FILES}
PYTEST_EXIT_CODE=$?
echo "pytest exit code: ${PYTEST_EXIT_CODE}"
if [ ${PYTEST_EXIT_CODE} -ne 0 ]; then
echo "pytest failed with exit code ${PYTEST_EXIT_CODE}"
exit ${PYTEST_EXIT_CODE}
fi
else
echo "No notebook files changed."
fi
fi