Skip to content

Notify Free Games

Notify Free Games #397

name: Notify Free Games
on:
schedule:
- cron: '0 12 * * *' # Runs daily at 12:00 UTC
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Dependencies
run: pip install requests python-dotenv
- name: Setup Notification History
run: |
if [ ! -f notification_history.json ]; then
echo '{"notified_games": []}' > notification_history.json
git add notification_history.json
fi
- name: Run Script
env:
SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
SMTP_PORT: ${{ secrets.SMTP_PORT }}
EMAIL: ${{ secrets.EMAIL }}
PASSWORD: ${{ secrets.PASSWORD }}
TO_EMAIL: ${{ secrets.TO_EMAIL }}
FROM_EMAIL: ${{ secrets.FROM_EMAIL }}
run: |
# Verify environment variables are set
if [ -z "$SMTP_SERVER" ] || [ -z "$SMTP_PORT" ] || [ -z "$EMAIL" ] || [ -z "$PASSWORD" ] || [ -z "$TO_EMAIL" ] || [ -z "$FROM_EMAIL" ]; then
echo "Error: Missing required environment variables"
exit 1
fi
python check_free_games.py
- name: Save Notification History
if: success()
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update notification history [skip ci]"
file_pattern: "notification_history.json"
commit_author: GitHub Actions <actions@github.com>
commit_options: '--no-verify'
status_options: '--untracked-files=no'
add_options: '-f'