-
Notifications
You must be signed in to change notification settings - Fork 2.2k
43 lines (38 loc) Β· 1.47 KB
/
check-external-doc-links.yml
File metadata and controls
43 lines (38 loc) Β· 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
name: Check for External Doc Links
on:
pull_request:
branches: [main]
paths:
- "**/*.md"
- "**/*.mdx"
jobs:
check-external-doc-links:
name: Block links to old doc sites
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Check for links to js.langchain.com and python.langchain.com
run: |
# Get the diff of added lines only (lines starting with +, excluding the +++ header)
ADDED_LINES=$(git diff origin/${{ github.base_ref }}...HEAD --diff-filter=ACMR -- '*.md' '*.mdx' | grep -E '^\+' | grep -v '^\+\+\+' || true)
# Check if any added lines contain links to the old doc sites
if echo "$ADDED_LINES" | grep -qE '(js\.langchain\.com|python\.langchain\.com)'; then
echo "β This PR adds links to deprecated documentation sites."
echo ""
echo "Links to js.langchain.com and python.langchain.com are not allowed."
echo "Please use relative links to reference documentation within this repository."
echo ""
echo "Matches found:"
echo "$ADDED_LINES" | grep -E '(js\.langchain\.com|python\.langchain\.com)' | head -20
exit 1
else
echo "β
No links to deprecated doc sites found in added content."
fi