-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (40 loc) · 1.3 KB
/
update_metrics.yaml
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
name: r/developersIndia metrics updater
on:
schedule:
# Everyday 9PM (IST)
- cron: '30 15 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Get Latest Subreddit & Discord Stats
env:
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }}
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
REDDIT_USER: ${{ secrets.REDDIT_USER }}
DISCORD_INVITE_CODE: ${{ secrets.DISCORD_INVITE_CODE }}
run: |
python main.py
- name: Commit files
run: |
git config user.email "actions@users.noreply.github.com"
git config user.name "Automated Publisher"
timestamp=$(date -u)
git commit -m "Automated publish: ${timestamp}" -a
- name: Push Updated Stats
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}