-
Notifications
You must be signed in to change notification settings - Fork 105
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
Draft
isahers1
wants to merge
21
commits into
main
Choose a base branch
from
isaac/doclink
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6702300
wip
isahers1 54dd6c6
edits
isahers1 29821fd
changes!
isahers1 ce3b270
x
isahers1 15ba576
link
isahers1 cdeb61e
x
isahers1 fc9155e
x
isahers1 e226b7f
messing with notebook
isahers1 c1a7ac8
x
isahers1 cc8ec4c
x
isahers1 3030bfe
x
isahers1 1334149
wip
isahers1 fa0c8f5
x
isahers1 d4a00b5
x
isahers1 b7ce2e8
z
isahers1 8d867f5
z
isahers1 0b89c62
x
isahers1 c1a468c
x
isahers1 4ec62ab
x
isahers1 0175008
x
isahers1 aada9b5
x
isahers1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Check Docs & Links | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
paths: | ||
- '**.ipynb' | ||
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: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
|
||
- name: Check links in notebooks | ||
env: | ||
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: | | ||
yarn check-links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"aliveStatusCodes": [200, 206, 402], | ||
"ignorePatterns": ["*dcbadge.vercel.app*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
const ignorePatterns = [ | ||
'https://(api|web)\\.smith\\.langchain\\.com/.*', | ||
'https://x\\.com/.*' | ||
]; | ||
|
||
function checkLinks() { | ||
const changedFiles = process.env.CHANGED_FILES ? process.env.CHANGED_FILES.split(' ') : []; | ||
const ipynbFiles = changedFiles.filter(file => file.endsWith('.ipynb')); | ||
|
||
console.log('Changed .ipynb files:', ipynbFiles); | ||
|
||
if (ipynbFiles.length === 0) { | ||
console.log('No .ipynb files were changed. Skipping link check.'); | ||
return; | ||
} | ||
|
||
for (const file of ipynbFiles) { | ||
console.log(`Checking links in ${file}`); | ||
try { | ||
execSync(`yarn linkinator ${file} ${ignorePatterns.map(pattern => `--skip "${pattern}"`).join(' ')}`, { stdio: 'inherit' }); | ||
} catch (error) { | ||
console.error(`Error checking links in ${file}:`, error); | ||
process.exit(1); | ||
} | ||
} | ||
} | ||
|
||
checkLinks(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 comment
The 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