generated from CloudWithChris/base-template
-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (39 loc) · 1.14 KB
/
google-analytics-top-pages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
on:
workflow_call:
inputs:
script_path:
default: ".github/workflows/scripts/google-analytics.js"
required: true
type: string
secrets:
GH_GOOGLE_FED_PROVIDER:
required: true
GA_API_SERVICE_ACC_EMAIL:
required: true
GA_TRACKING_ID:
required: true
jobs:
google_analytics_top_posts:
name: 'Get top posts from Google Analytics'
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@main
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: '${{ secrets.GH_GOOGLE_FED_PROVIDER }}'
service_account: '${{ secrets.GA_API_SERVICE_ACC_EMAIL}}'
- run: |
npm install @google-analytics/data
- uses: actions/github-script@v6
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
with:
script: |
const script = require('${{ inputs.script_path }}')
await script({github, context, core})