generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 20
42 lines (35 loc) · 1.11 KB
/
update-mint-json.yml
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
40
41
42
name: Update mint.json with GA4 Measurement ID
on:
push:
branches:
- main
workflow_dispatch:
jobs:
update-mint-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install jq
run: sudo apt-get install jq
- name: Update mint.json with GA4 Measurement ID
run: |
if [ -z "$GA4_MEASUREMENT_ID" ]; then
echo "GA4_MEASUREMENT_ID is not set"
exit 1
fi
jq '.analytics.ga4.measurementId = env.GA4_MEASUREMENT_ID' mint.json > mint.json.tmp
mv mint.json.tmp mint.json
env:
GA4_MEASUREMENT_ID: ${{ secrets.GA4_MEASUREMENT_ID }}
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add mint.json
git commit -m 'Update GA4 measurement ID in mint.json'
git push