r/developersIndia metrics updater #650
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
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 }} |