Skip to content

Commit 7741ba1

Browse files
committed
added an analytics ci
1 parent d4d0883 commit 7741ba1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/workflows/analytics.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: analytics
2+
# Triggers the workflow every 5 minutes
3+
on:
4+
push
5+
# schedule:
6+
# - cron: "* * * * *"
7+
jobs:
8+
cron:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-python@v4
13+
with:
14+
python-version: '3.10'
15+
- run: python -m pip install -r analytics/requirements.txt
16+
- env:
17+
GH_SECRET: ${{ secrets.GITHUB_TOKEN }}
18+
run: python .github/workflows/analytics/cron.py

.github/workflows/cron.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
3+
import requests
4+
5+
GH_SECRET = os.environ.get('GH_SECRET')
6+
GH_TRAFFIC_VIEWS_URL = "https://api.github.com/repos/explodinggradients/ragas/traffic/views"
7+
8+
repo_response = requests.get(GH_TRAFFIC_VIEWS_URL,headers={
9+
'Accept': 'application/vnd.github.v3+json',
10+
'Authorization': f"Bearer {GH_SECRET}"
11+
})
12+
print(repo_response.json())

0 commit comments

Comments
 (0)