Scrape depression tweets #435
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: Scrape depression tweets | |
# FYI cron | |
# ┌────────── minute (0 - 59) | |
# │ ┌────────── hour (0 - 23) | |
# │ │ ┌────────── day of the month (1 - 31) | |
# │ │ │ ┌────────── month (1 - 12) | |
# │ │ │ │ ┌────────── day of the week (0 - 6) | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# * * * * * | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # @daily | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Fetch latest data | |
run: python twitter_scraper.py | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
- name: Push changes # push the output folder to your repo, turn on workflow read and write permission | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true |