From 53a93e1b527dcf50b9635012a7b37547052b2643 Mon Sep 17 00:00:00 2001 From: richarddushime Date: Wed, 20 Aug 2025 13:59:46 +0200 Subject: [PATCH 1/2] [debugging]Analytics data --- .github/workflows/data-processing.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/data-processing.yml b/.github/workflows/data-processing.yml index 739c386e287..b861ebf111c 100644 --- a/.github/workflows/data-processing.yml +++ b/.github/workflows/data-processing.yml @@ -82,7 +82,19 @@ jobs: env: GA_API_CREDENTIALS: ${{ secrets.GA_API_CREDENTIALS }} GA_PROPERTY_ID: ${{ secrets.GA_PROPERTY_ID }} - run: python scripts/download_ga_data.py + run: | + echo "Starting GA data download..." + if [ -z "$GA_API_CREDENTIALS" ]; then + echo "❌ GA_API_CREDENTIALS is not set" + exit 1 + fi + if [ -z "$GA_PROPERTY_ID" ]; then + echo "❌ GA_PROPERTY_ID is not set" + exit 1 + fi + echo "✅ Credentials are set, running script..." + python scripts/download_ga_data.py + echo "✅ GA data download completed" - name: Run Google Scholar script continue-on-error: true # Continue even if this step fails From 209f8573233ea59961061b4ac700fcfaa87d5220 Mon Sep 17 00:00:00 2001 From: richarddushime Date: Wed, 20 Aug 2025 15:02:06 +0200 Subject: [PATCH 2/2] fix dowloading the ga data in data processing --- .github/workflows/data-processing.yml | 36 ++++++++++++++++++++++- .github/workflows/deploy.yaml | 1 + layouts/shortcodes/ga_daily_visitors.html | 2 +- layouts/shortcodes/ga_map.html | 2 +- layouts/shortcodes/ga_top_pages.html | 2 +- scripts/download_ga_data.py | 4 +-- 6 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.github/workflows/data-processing.yml b/.github/workflows/data-processing.yml index b861ebf111c..3e8696f67ef 100644 --- a/.github/workflows/data-processing.yml +++ b/.github/workflows/data-processing.yml @@ -93,8 +93,25 @@ jobs: exit 1 fi echo "✅ Credentials are set, running script..." + + # Ensure data/ga_data directory exists + mkdir -p data/ga_data + echo "✅ data/ga_data directory created/verified" + + # Run the script (it will create data/ga_data.json) python scripts/download_ga_data.py echo "✅ GA data download completed" + + # Verify the file was created in the new location + if [ -f "data/ga_data/ga_data.json" ]; then + echo "✅ GA data file exists in data/ga_data/" + echo "File size: $(wc -c < data/ga_data/ga_data.json) bytes" + echo "File contents preview:" + head -5 data/ga_data/ga_data.json + else + echo "❌ GA data file was not created in data/ga_data/" + exit 1 + fi - name: Run Google Scholar script continue-on-error: true # Continue even if this step fails @@ -102,6 +119,22 @@ jobs: env: SERPAPI: ${{ secrets.SERPAPI }} + - name: Verify data before upload + run: | + echo "=== Verifying data before upload ===" + echo "Current directory: $(pwd)" + echo "Data directory contents:" + ls -la data/ || echo "Data directory does not exist" + echo "GA data directory contents:" + ls -la data/ga_data/ || echo "GA data directory does not exist" + if [ -f "data/ga_data/ga_data.json" ]; then + echo "✅ GA data file exists in data/ga_data/" + echo "File size: $(wc -c < data/ga_data/ga_data.json) bytes" + echo "File modified: $(stat -c %y data/ga_data/ga_data.json)" + else + echo "❌ GA data file missing from data/ga_data/" + fi + - name: Upload data artifact uses: actions/upload-artifact@v4 with: @@ -109,7 +142,8 @@ jobs: path: | content/contributors/tenzing.md content/curated_resources/ - data/ # GA data + data/ga_data/ga_data.json # GA data + data/ # other content/contributor-analysis/ content/publications/citation_chart.webp retention-days: 1 diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 2051b45eb1a..b6ef9b3fc5d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -55,6 +55,7 @@ jobs: # Download GA data if possible if [ "${{ github.event_name }}" != 'pull_request' ]; then + mkdir -p data/ga_data python scripts/download_ga_data.py fi diff --git a/layouts/shortcodes/ga_daily_visitors.html b/layouts/shortcodes/ga_daily_visitors.html index 94fdd11d63b..01515e47a5b 100644 --- a/layouts/shortcodes/ga_daily_visitors.html +++ b/layouts/shortcodes/ga_daily_visitors.html @@ -3,7 +3,7 @@