@@ -71,31 +71,33 @@ jobs:
7171 return 0
7272 }
7373
74- # Process each SQL file
74+ # Find the manifest.toml once at the start
75+ MANIFEST_PATH=""
7576 for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
76- echo "Processing $file"
77-
78- # Find and parse manifest.toml
7977 DIR_PATH=$(dirname "$file")
80- MANIFEST_PATH=""
8178 while [[ "$DIR_PATH" == export* ]]; do
8279 if [[ -f "$DIR_PATH/manifest.toml" ]]; then
8380 MANIFEST_PATH="$DIR_PATH/manifest.toml"
84- break
81+ break 2 # Break out of both loops once found
8582 fi
8683 DIR_PATH=$(dirname "$DIR_PATH")
8784 done
88-
89- if [[ -z "$MANIFEST_PATH" ]]; then
90- echo "Error: No manifest.toml found for $file"
91- exit 1
92- fi
93-
94- # Parse manifest.toml
95- PROJECT=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['project'])")
96- INSTANCE=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['instance'])")
97- DATABASE=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['database'])")
98- FORMAT=$(python3 -c "import toml; config=toml.load('$MANIFEST_PATH'); print(config.get('format', 'JSON'))")
85+ done
86+
87+ if [[ -z "$MANIFEST_PATH" ]]; then
88+ echo "Error: No manifest.toml found in the export directory"
89+ exit 1
90+ fi
91+
92+ # Parse manifest.toml once
93+ PROJECT=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['project'])")
94+ INSTANCE=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['instance'])")
95+ DATABASE=$(python3 -c "import toml; print(toml.load('$MANIFEST_PATH')['database'])")
96+ FORMAT=$(python3 -c "import toml; config=toml.load('$MANIFEST_PATH'); print(config.get('format', 'JSON'))")
97+
98+ # Process each SQL file
99+ for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
100+ echo "Processing $file"
99101
100102 # Read SQL content and encode to base64
101103 SQL_CONTENT=$(base64 < "$file")
0 commit comments