-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 2.01 KB
/
metrics-runner.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Update Metrics
on:
schedule:
- cron: "0 */12 * * *" # Runs at minute 0 past every 12th hour.
workflow_dispatch:
jobs:
update_metrics:
runs-on: ubuntu-latest
steps:
- name: 📟 Check out repository
uses: actions/checkout@v4
with:
lfs: true
- name: 📥 Install Git LFS
run: |
sudo apt-get update
sudo apt-get install git-lfs
git lfs install
- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: 📦 Install dependencies
run: |
pip install poetry toml
poetry install --no-interaction --no-ansi
- name: 🌐 Set Environment Variables
run: |
echo "POSTGRES_USERNAME=${{ secrets.POSTGRES_USERNAME }}" >> $GITHUB_ENV
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD}}" >> $GITHUB_ENV
echo "POSTGRES_URL=${{ secrets.POSTGRES_URL }}" >> $GITHUB_ENV
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV
echo "TWITTER_BEARER_TOKEN=${{ secrets.TWITTER_BEARER_TOKEN }}" >> $GITHUB_ENV
echo "REDDIT_CLIENT_ID=${{ secrets.REDDIT_CLIENT_ID }}" >> $GITHUB_ENV
echo "REDDIT_CLIENT_SECRET=${{ secrets.REDDIT_CLIENT_SECRET }}" >> $GITHUB_ENV
echo "REDDIT_USER_AGENT=${{ secrets.REDDIT_USER_AGENT }}" >> $GITHUB_ENV
echo "DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }}" >> $GITHUB_ENV
echo "NEWSAPI_TOKEN=${{ secrets.NEWSAPI_TOKEN }}" >> $GITHUB_ENV
echo "YOUTUBE_TOKEN=${{ secrets.YOUTUBE_TOKEN }}" >> $GITHUB_ENV
echo "MAILCHIMP_ZONE=${{ secrets.MAILCHIMP_ZONE }}" >> $GITHUB_ENV
echo "MAILCHIMP_API_KEY=${{ secrets.MAILCHIMP_API_KEY }}" >> $GITHUB_ENV
- name: 🧬 Run script
run: poetry run python main.py
- name: 📊 Commit metrics file
uses: EndBug/[email protected]
with:
add: "metrics.json"
message: "Update metrics file"