fix(docs): add validation for repository format and name in API docs build workflow (#32246)

for build
This commit is contained in:
Mason Daugherty 2025-07-25 15:05:06 -04:00 committed by GitHub
parent db22311094
commit df20f111a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,10 +50,10 @@ jobs:
# Get unique repositories # Get unique repositories
REPOS=$(echo "$REPOS_UNSORTED" | sort -u) REPOS=$(echo "$REPOS_UNSORTED" | sort -u)
# Checkout each unique repository that is in langchain-ai org # Checkout each unique repository
for repo in $REPOS; do for repo in $REPOS; do
# Validate repository is in langchain-ai org # Validate repository format (allow any org with proper format)
if [[ ! "$repo" =~ ^langchain-ai/[a-zA-Z0-9_-]+$ ]]; then if [[ ! "$repo" =~ ^[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+$ ]]; then
echo "Error: Invalid repository format: $repo" echo "Error: Invalid repository format: $repo"
exit 1 exit 1
fi fi
@ -61,7 +61,7 @@ jobs:
REPO_NAME=$(echo $repo | cut -d'/' -f2) REPO_NAME=$(echo $repo | cut -d'/' -f2)
# Additional validation for repo name # Additional validation for repo name
if [[ ! "$REPO_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then if [[ ! "$REPO_NAME" =~ ^[a-zA-Z0-9_.-]+$ ]]; then
echo "Error: Invalid repository name: $REPO_NAME" echo "Error: Invalid repository name: $REPO_NAME"
exit 1 exit 1
fi fi