GitHub Actions, Issues and Pages to build a daily planner#
I’m trying a new thing: a private daily planner, where each day I note down my goals for the day and make notes on my progress towards them as the day progresses.
I love using GitHub Issues for notes (see this comment) so I decided to set something up there.
I want a fresh issue in my private simonw/planner repo for every day that I’m working. The issue should have the day’s date, and should prompt me for my goals.
So… I needed a mechanism for automatically creating a new issue every day.
I used ChatGPT a bunch to help build this - a slightly edited transcript is available here.
This defines an issue template. By selecting that template I get a form that looks like this:
This is a neat starting point, but I can do better than that. It turns out you can pre-populate the title field of an issue by passing ?title=... in the URL.
This URL will pre-populate that form with a custom title.
I can link to that page with today’s date to create a new issue - but I’d like to be able to automatically jump to the day’s issue if it’s been created, and only link to the form if it has not.
A page that creates or redirects to the issue for the day#
My repo is private, but private repos can still use GitHub Pages. I decided to solve this problem using a client-side JavaScript page that I could set as the homepage in Firefox, so hitting Command+N on my keyboard would open up my daily planner issue, or the pre-populated creation form if it doesn’t exist yet.
I got ChatGPT to write the initial version of the following, which I then tweaked to fully meet my evolving requirements:
As you can see, the trick here is that it expects to be able to load an issue-titles.json file with a list of issues in the repo.
The repo may be private, but I’m OK with exposing the issue titles here.
How to create issue-titles.json? I can do that using GitHub Actions.
GitHub Actions workflow to create issue-titles.json#
I started with this prompt:
Write a GitHub Actions workflow which retrieves a list of issue names and URLs for the current repo, converts those into a JSON array and then publishes that as issue-titles.json using GitHub Pages
publish_branch: gh-pages# The branch GitHub Pages uses
36
keep_files: true
This is using an older way of deploying to GitHub Pages. I hand-edited the workflow a few times until I got this, stored in .github/workflows/issues.yml:
Then I configured GitHub Pages for that repo like this:
Adding this all together, I now have a mechanism where any time I open a new issue the issue-titles.json file is updated, and then deployed to GitHub Pages along with the index.html page that reads it and redirects to an issue or to the form that creates a new one.
My simonw/planner private repo now contains the following files:
1
index.html
2
issue-titles.json
3
.github/workflows/issues.yml
4
.github/ISSUE_TEMPLATE/day.yml
The generated issue-titles.json file currently looks like this:
Now, any time I hit Command+N in Firefox I get a browser window that loads https://simonw.github.io/planner/ and then either redirects me to the issue for today or sends me to a pre-populated form to create a new issue.
I love throwing together little custom applications like this on top of GitHub Actions and GitHub Pages.
I also love that I didn’t have to write much code for this at all - ChatGPT is good enough at both GitHub Actions syntax and HTML and JavaScript that I could get it to do 80% of the work for me.
GitHub Actions, Issues and Pages to build a daily planner