Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created June 20, 2024 14:36
Show Gist options
  • Save PaulieScanlon/ec5586e80733e3ac360ed7f56081d9cd to your computer and use it in GitHub Desktop.
Save PaulieScanlon/ec5586e80733e3ac360ed7f56081d9cd to your computer and use it in GitHub Desktop.
GitHub Action
# .github/workflows/analytics-report.yml
name: 7 Day Google Analytics Report
on:
schedule:
- cron: '0 10 * * 5' # Runs every Friday at 10 AM UTC
workflow_dispatch: # Allows manual triggering
jobs:
analytics-report:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm ci
- name: Run the JavaScript script
run: node src/index.js
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
GA4_PROPERTY_ID: ${{ secrets.GA4_PROPERTY_ID }}
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment