Create traffic-exporter.yml

automated metrics extraction
This commit is contained in:
Suheb 2025-09-20 17:55:31 -07:00 committed by GitHub
parent 7340cb390a
commit c27f4aff45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

37
.github/workflows/traffic-exporter.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Export Repo Traffic to Google Sheets
on:
schedule:
# Runs at 02:00 UTC every day
- cron: '0 2 * * *'
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install gspread oauth2client requests
- name: Write Google credentials to a file
id: write_creds
uses: timheuer/base64-to-file@v1.2
with:
fileName: 'google-credentials.json'
encodedString: ${{ secrets.GOOGLE_SHEETS_CREDENTIALS }}
- name: Run the Python script
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GOOGLE_SHEETS_CREDENTIALS: ${{ steps.write_creds.outputs.filePath }}
run: python export_traffic.py