Update Metrics #428
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: 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/add-and-commit@v9.1.4 | |
with: | |
add: "metrics.json" | |
message: "Update metrics file" |