-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci[minor]: Add GitHub action to check broken links #403
base: main
Are you sure you want to change the base?
Changes from 6 commits
6702300
54dd6c6
29821fd
ce3b270
15ba576
cdeb61e
fc9155e
e226b7f
c1a7ac8
cc8ec4c
3030bfe
1334149
fa0c8f5
d4a00b5
b7ce2e8
8d867f5
0b89c62
c1a468c
4ec62ab
0175008
aada9b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Check Docs & 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/,docs/" | ||
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 Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.x' | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: | | ||
yarn install --frozen-lockfile | ||
|
||
- 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prob dont need this since we have the condition at the top which will only run this on a pr push, push to main, workflow dispatch, or scheduling |
||
echo "Running link check on all notebooks in examples directory..." | ||
yarn run pytest -v --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" --check-links examples | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. langsmith links stuff was copied over, not sure why but assume there was a reason. tried to fix the pytest stuff in next push |
||
else | ||
echo "Fetching changes from origin/main..." | ||
git fetch origin main | ||
echo "Checking for changed notebook files..." | ||
CHANGED_FILES=$(git diff --name-only --diff-filter=d origin/main | grep '\.ipynb$' || true) | ||
echo "Changed files: ${CHANGED_FILES}" | ||
if [ -n "${CHANGED_FILES}" ]; then | ||
echo "Running link check on changed notebook files..." | ||
yarn run pytest -v --check-links-ignore "https://(api|web)\.smith\.langchain\.com/.*" --check-links-ignore "https://x.com/.*" --check-links ${CHANGED_FILES} || ([ $? = 5 ] && exit 0 || exit $?) | ||
else | ||
echo "No notebook files changed." | ||
fi | ||
fi | ||
check-readmes-synced: | ||
# This checks that the repo README.md is identical to the libs/langgraph/README.md | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Check README.md is in sync | ||
run: | | ||
if ! diff -q README.md libs/langgraph/README.md >/dev/null; then | ||
echo "README.md is out of sync with libs/langgraph/README.md" | ||
diff -C 3 README.md libs/langgraph/README.md | ||
exit 1 | ||
fi | ||
isahers1 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"aliveStatusCodes": [200, 206, 402], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to do ranges? We prob want all 200's, all 300's, etc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my brief chat-gpt research it's not easily doable programatically. I just copied this from the main langgraph one so I assume someone smarter than me had a good reason for selecting these codes but idk |
||
"ignorePatterns": ["*dcbadge.vercel.app*"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the code below, it looks like you only want
.ipynb
files, in that case do thisand no need for scheduling, just have it run in PRs and on commits to main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, unless this is because we want to have a recurring check. Prob makes sense. In that case ya keep the scheduling.