-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfetch_integrations.sh
More file actions
executable file
·93 lines (71 loc) · 2.52 KB
/
fetch_integrations.sh
File metadata and controls
executable file
·93 lines (71 loc) · 2.52 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
set -e
REPO_LIST_FILE="integrations.txt"
TEMP_DIR="integrations-tmp"
LANGUAGES=("en" "az")
if [ ! -f "$REPO_LIST_FILE" ]; then
echo "❌ $REPO_LIST_FILE not found!"
exit 1
fi
# Clean temp and output dirs
rm -rf "$TEMP_DIR"
mkdir -p "$TEMP_DIR"
DEST_SRC="src/"
rm -rf "$DEST_SRC"/integrify/*
# Clean docs for both languages
for LANG in "${LANGUAGES[@]}"; do
DEST_DOCS="docs/$LANG/docs/integrations"
# Remove all folders (and keep index.md)
find "$DEST_DOCS" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
done
echo "🔄 Starting to fetch integrations..."
while IFS= read -r REPO_URL; do
[ -z "$REPO_URL" ] && continue # Skip empty lines
REPO_NAME=$(basename "$REPO_URL" .git)
INTEGRATION_NAME="${REPO_NAME#integrify-}" # Remove prefix
INTEGRATION_NAME="${INTEGRATION_NAME%-python}" # Remove suffix
echo "📦 Fetching $REPO_NAME from $REPO_URL"
git clone --depth 1 "$REPO_URL" "$TEMP_DIR/$REPO_NAME"
# Copy source code (language-independent)
SRC_PATH="$TEMP_DIR/$REPO_NAME/src/integrify/"
if [ -d "$SRC_PATH" ]; then
cp -r "$SRC_PATH" "$DEST_SRC"
echo " ✓ Copied source code"
else
echo " ⚠️ No source code found at $SRC_PATH"
fi
# Copy documentation and partials for each language
for LANG in "${LANGUAGES[@]}"; do
LANG_DIR="$TEMP_DIR/$REPO_NAME/docs/$LANG"
if [ ! -d "$LANG_DIR" ]; then
echo " ⚠️ Language '$LANG' not found, skipping"
continue
fi
echo " 📄 Processing language: $LANG"
# Copy documentation
DOCS_PATH="$LANG_DIR/docs/integrations"
DEST_DOCS="docs/$LANG/docs/integrations"
if [ -d "$DOCS_PATH" ]; then
mkdir -p "$DEST_DOCS"
cp -r "$DOCS_PATH" "$DEST_DOCS/../"
echo " ✓ Copied $LANG documentation"
else
echo " ⚠️ No documentation found at $DOCS_PATH"
fi
echo "✅ Done with $REPO_NAME"
echo ""
done
# Copy partials
PARTIALS_PATH="$TEMP_DIR/$REPO_NAME/docs/partial.yml"
DEST_PARTIALS="docs/navs/$INTEGRATION_NAME.yml"
if [ -f "$PARTIALS_PATH" ]; then
cp "$PARTIALS_PATH" "$DEST_PARTIALS"
echo " ✓ Copied partials"
else
echo " ⚠️ No partial.yml found at $PARTIALS_PATH"
fi
done < "$REPO_LIST_FILE"
cp -r docs/az/docs/integrations/core docs/en/docs/integrations/
# Clean up temp files
rm -rf "$TEMP_DIR"
echo "🎉 All integrations fetched and updated successfully."