Daily Quote Update #15
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: Daily Quote Update | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs at 00:00 UTC every day | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
update-quotes: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Needed for pushing to the repository | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for git pull | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
cache: 'pip' | |
- name: Configure Git | |
run: | | |
# git config --global user.name 'github-actions[bot]' | |
# git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global user.name 'hipnologo' | |
git config --global user.email '21972160+hipnologo@users.noreply.github.com' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run daily quote script | |
env: | |
API_NINJAS_KEY: ${{ secrets.API_NINJAS_KEY }} | |
run: python daily_quote.py | |
- name: Check and commit changes | |
run: | | |
if [[ -n "$(git status --porcelain)" ]]; then | |
echo "Changes detected. Committing updates..." | |
git add quotes.txt quotes_es.txt quotes_pt.txt | |
git commit -m "Daily inspirational quote update - $(date '+%Y-%m-%d %H:%M:%S')" | |
git push | |
echo "Repository updated successfully." | |
else | |
echo "No changes detected. Skipping commit." | |
fi |