Skip to content

GitBook Analytics

GitBook Analytics #144

Workflow file for this run

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/[email protected]
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