GitBook Analytics #145
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |