
At Electron Green, I was using AWS CDK to as the Infrastructure as Code tool. I gave my ECR assets a relatively short TTL to not waste storage, but this could mean that my bi-monthly ECS tasks could fail as the base image was gone. The good thing about CDK is that it will re-create images if they're not present, meaning that using Github's built-in scheduler was a free, painless way of keeping things in sync.
The Basics
Scheduled tasks use
cron
under the hood:on:
schedule:
- cron: '0 6 * * *' # every day at 6am UTC
Your full workflow might look like:
name: Daily Cleanup
on:
schedule:
- cron: '0 6 * * *'
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Clean things up here"
That’s it. GitHub wakes up daily, runs your task, and disappears.
Quick Notes
- Cron is UTC. Adjust accordingly.
- Test with
workflow_dispatch
to avoid waiting until tomorrow. - No persistent storage, so external state lives elsewhere.
For anything you'd normally script and forget, GitHub Scheduler is a clean, serverless solution. Just automation, done right.