-
Notifications
You must be signed in to change notification settings - Fork 2.2k
44 lines (39 loc) Β· 1.36 KB
/
check-deprecated.yml
File metadata and controls
44 lines (39 loc) Β· 1.36 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
44
---
name: Check for deprecated patterns
on:
pull_request:
branches: [main]
paths:
- "**/*.py"
- "**/*.md"
- "**/*.mdx"
jobs:
check-deprecated:
name: Block deprecated examples
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 create_react_agent in diff
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 -- '*.py' '*.md' '*.mdx' '*.ipynb' | grep -E '^\+' | grep -v '^\+\+\+' || true)
# Check if any added lines contain create_react_agent
if echo "$ADDED_LINES" | grep -q 'create_react_agent'; then
echo "β This PR adds code containing 'create_react_agent'."
echo ""
echo "The create_react_agent pattern is deprecated. Please use the recommended"
echo "agent patterns instead."
echo ""
echo "Matches found:"
echo "$ADDED_LINES" | grep 'create_react_agent' | head -20
exit 1
else
echo "β
No create_react_agent examples found in added code."
fi