-
-
Notifications
You must be signed in to change notification settings - Fork 15
28 lines (26 loc) · 915 Bytes
/
analytics.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
name: GitBook Analytics
on:
workflow_dispatch:
schedule:
# every week
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Analytics Data
id: analytics-data
run: |
echo ::set-output name=views::$(curl -sH "Authorization: Bearer ${{ secrets.GITBOOK_API_TOKEN }}" https://api.gitbook.com/v1/spaces/${{ secrets.GITBOOK_SPACE }}/analytics/traffic?interval=monthly | jq .count | numfmt --to=si)
- name: Create Awesome Badge
uses: schneegans/dynamic-badges-action@v1.1.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: e32f40010ce09c09919b04117bee2581
filename: analytics.json
label: ${{ steps.analytics-data.outputs.views }}
message: Monthly Views
color: "#bf155b"
namedLogo: gitbook
logoColor: white