Netlify - Daily run #901
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
# Based on example from | |
# https://github.com/NiklasMerz/netlify-analytics-collector/tree/main/.github/workflows | |
name: Netlify - Daily run | |
on: | |
schedule: | |
- cron: '55 23 * * *' | |
workflow_dispatch: | |
jobs: | |
export-run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: niklasmerz/[email protected] | |
with: | |
netlify-token: ${{ secrets.NETLIFY_TOKEN }} | |
netlify-site-id: ${{ secrets.NETLIFY_SITE }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: exports | |
path: '*.csv' | |
sheet-upload: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: netlify-stats | |
- uses: niklasmerz/[email protected] | |
with: | |
netlify-token: ${{ secrets.NETLIFY_TOKEN }} | |
netlify-site-id: ${{ secrets.NETLIFY_SITE }} | |
days: -1 | |
disable-header: true | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: '*.csv' | |
message: "[ci skip] fluxcd.io stats from netlify-analytics" | |
#signoff: true | |
#new_branch: netlify-stats | |
- uses: kingdonb/[email protected] | |
with: | |
csv_path: pageviews.csv | |
spreadsheet_id: ${{ secrets.google_spreadsheet_id }} | |
worksheet: 0 | |
append_content: true | |
# The credential is from the "kingdon-flux-netlify-exporter" account in dx-kingdon project | |
# that is also known as: '[email protected]' | |
# (It has no permissions except that it has been shared the doc above, with editor access.) | |
google_service_account_email: ${{ secrets.google_service_account_email }} | |
google_service_account_private_key: ${{ secrets.google_service_account_private_key }} | |
- uses: kingdonb/[email protected] | |
with: | |
csv_path: visitors.csv | |
spreadsheet_id: ${{ secrets.google_spreadsheet_id }} | |
worksheet: 1 | |
append_content: true | |
google_service_account_email: ${{ secrets.google_service_account_email }} | |
google_service_account_private_key: ${{ secrets.google_service_account_private_key }} | |
- uses: kingdonb/[email protected] | |
with: | |
csv_path: bandwidth.csv | |
spreadsheet_id: ${{ secrets.google_spreadsheet_id }} | |
worksheet: 2 | |
append_content: true | |
google_service_account_email: ${{ secrets.google_service_account_email }} | |
google_service_account_private_key: ${{ secrets.google_service_account_private_key }} |