Track Campaign Metrics #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Track Campaign Metrics | |
| on: | |
| schedule: | |
| # Run daily at 9 AM UTC (4 AM EST / 1 AM PST) | |
| - cron: '0 9 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| track-metrics: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Needed to commit metrics file | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: Track campaign metrics | |
| run: | | |
| python scripts/track_campaign_metrics.py \ | |
| --output docs/marketing/CAMPAIGN_METRICS_DAILY.md | |
| - name: Commit metrics update | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| # Check if there are changes | |
| if git diff --quiet docs/marketing/CAMPAIGN_METRICS_DAILY.md; then | |
| echo "No metrics changes detected" | |
| else | |
| git add docs/marketing/CAMPAIGN_METRICS_DAILY.md | |
| git commit -m "chore: Update daily campaign metrics [skip ci]" | |
| git push | |
| echo "Metrics updated successfully" | |
| fi | |
| - name: Create metrics summary | |
| run: | | |
| echo "## Daily Metrics Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| tail -n 50 docs/marketing/CAMPAIGN_METRICS_DAILY.md >> $GITHUB_STEP_SUMMARY |