Toot #2
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: Toot | |
on: | |
# Run when I click "run workflow" | |
# in the GitHub UI - for debugging | |
workflow_dispatch: | |
schedule: | |
# Run at 16:11 UTC every day | |
# which is 18:11 pm in Germany (summer time) | |
- cron: '11 16 * * *' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Python with pip cache | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Configure Git for commits | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
- name: Run the mastodon bot | |
env: | |
TOOT_CONFIG: ${{ secrets.PYTOOTER_USERCRED }} | |
# Write that information to the secret file | |
run: |- | |
echo $TOOT_CONFIG > ~/.config/pytooter_usercred.secret | |
python mastodon_bot.py | |
# So we can see what it last did: | |
- name: Commit posts.csv | |
run: |- | |
git add posts.csv | |
timestamp=$(date -u) | |
git commit -m "${timestamp}" || exit 0 | |
git push |