Skip to content

Check Links

Check Links #790

Workflow file for this run

name: Check Links
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "0 5 * * *"
workflow_dispatch:
env:
POETRY_VERSION: "1.7.1"
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check links in Markdown files
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
folder-path: 'examples/'
check-modified-files-only: ${{ github.event_name != 'schedule' }}
file-path: './README.md'
config-file: './.markdown-link-check.config.json'
notebook-link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.x + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: "3.11"
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: core
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install --with test
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