Check Epic Games #18
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: Check Epic Games | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Environment to deploy to' | |
required: true | |
type: choice | |
options: | |
- dev | |
- production | |
schedule: | |
# - cron: '30 23 * * THU' | |
# weekly regular epic games schedule | |
- cron: '30 17 * 1-11 THU' | |
# - cron: '30 23 1-12,29-31 12 THU' | |
# 15 days of december mystery games (daily) | |
- cron: '30 23 13-31 12 *' | |
- cron: '30 23 1-3 1 *' | |
env: | |
WORKING_DIRECTORY: 'bot' | |
defaults: | |
run: | |
working-directory: ./bot | |
jobs: | |
check_free_games: | |
name: Check Epic Games Freebies | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment || 'production' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.17 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run | |
env: | |
SEND_UPCOMING: ${{ false }} | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
run: npm run start | |
- name: bump lastrun | |
run: | | |
echo $(date) > lastrun | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add lastrun | |
git commit -m "update lastrun" | |
git push | |
- name: Notify on failure | |
if: ${{ failure() }} | |
env: | |
DISCORD_MESSAGE: "Workflow failed at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
run: | | |
curl -H "Content-Type: application/json" \ | |
-d '{"username": "${{ github.repository }}/${{ github.workflow }}", "content": "${{ env.DISCORD_MESSAGE }}"}' \ | |
"${{ secrets.DISCORD_ALERTS_WEBHOOK }}" | |