Robots that never forget
Your script is in the repository now (scripts/logreport.sh). Let GitHub Actions run the tests on every push and pull request — and run the log report every night on a schedule, raising an alert when it finds errors.
One workflow, different events
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
test:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
logs:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log report
run: bash scripts/logreport.sh logs/app.log
- name: Alert
if: failure()
run: echo "ALERT: errors found in logs/app.log"