Skip to content

Commit 15c7b26

Browse files
more debugging steps
1 parent f4efe1a commit 15c7b26

1 file changed

Lines changed: 49 additions & 14 deletions

File tree

.github/workflows/data-processing.yml

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,29 @@ jobs:
9393
exit 1
9494
fi
9595
echo "✅ Credentials are set, running script..."
96+
97+
# Delete old GA data file before creating new one
98+
echo "=== Cleaning up old GA data file ==="
99+
if [ -f "data/ga_data.json" ]; then
100+
echo "Found old file: data/ga_data.json"
101+
echo "Old file size: $(wc -c < data/ga_data.json) bytes"
102+
echo "Old file modified: $(stat -c %y data/ga_data.json)"
103+
echo "Removing old file..."
104+
rm -f data/ga_data.json
105+
echo "✅ Old file removed"
106+
else
107+
echo "No old file found at data/ga_data.json"
108+
fi
109+
110+
# Also clean up any nested files
111+
if [ -d "data/ga_data" ]; then
112+
echo "Found old nested directory: data/ga_data/"
113+
echo "Removing nested directory..."
114+
rm -rf data/ga_data/
115+
echo "✅ Nested directory removed"
116+
fi
117+
118+
echo "=== Running GA data download script ==="
96119
python scripts/download_ga_data.py
97120
echo "✅ GA data download completed"
98121
@@ -111,6 +134,30 @@ jobs:
111134
env:
112135
SERPAPI: ${{ secrets.SERPAPI }}
113136

137+
- name: Verify GA data file exists
138+
run: |
139+
echo "=== Verifying GA data file ==="
140+
141+
# Clean up any old nested files
142+
if [ -f "data/ga_data/ga_data.json" ]; then
143+
echo "Found old nested file, removing..."
144+
rm -rf data/ga_data/
145+
fi
146+
147+
# Check for the correct file
148+
if [ -f "data/ga_data.json" ]; then
149+
echo "✅ GA data file exists in data/ga_data.json"
150+
echo "File size: $(wc -c < data/ga_data.json) bytes"
151+
echo "File modified: $(stat -c %y data/ga_data.json)"
152+
echo "File contents preview:"
153+
head -3 data/ga_data.json
154+
else
155+
echo "❌ GA data file missing from data/ga_data.json"
156+
echo "Available files in data/:"
157+
ls -la data/ || echo "data/ directory does not exist"
158+
exit 1
159+
fi
160+
114161
- name: Commit and push GA data to ga branch
115162
if: github.event_name != 'pull_request'
116163
run: |
@@ -123,26 +170,14 @@ jobs:
123170
# Checkout master branch
124171
git checkout ga
125172
126-
# Remove old GA data file if it exists (force removal)
127-
if [ -f "data/ga_data.json" ]; then
128-
echo "Removing old GA data file..."
129-
git rm -f data/ga_data.json || rm -f data/ga_data.json
130-
fi
131-
132-
# Copy the new GA data file from the working directory
133-
echo "Adding new GA data file..."
134-
cp data/ga_data.json data/ga_data.json.new
135-
mv data/ga_data.json.new data/ga_data.json
136-
137-
# Add and commit the file
173+
# Add and commit the GA data file directly (no removal needed)
174+
echo "Adding GA data file..."
138175
git add data/ga_data.json
139176
git commit -m "Update GA data - $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
140177
141178
# Push to master
142179
git push origin ga
143180
echo "✅ GA data committed and pushed to master branch"
144-
145-
- name: Verify GA data file exists
146181
run: |
147182
echo "=== Verifying GA data file ==="
148183

0 commit comments

Comments
 (0)