A GitHub action that can be used with a TIL repo to autogenerate a README.md.
I came across this post (Using a self-rewriting README powered by GitHub Actions to track TILs) from Simon Willison on Hacker News and thought it was a pretty good idea. The author talks about how he uses TILs to learn in public and how he uses GitHub actions to automatically create a formatted README.md summary of his TILs when he pushes code. I saw this and thought, hey if we use GitHub actions to do this, why not make a GitHub Action?
If you have a TIL repository with TILs organized into folders by category you can add this GitHub action to generate a nice README when you push a new TIL.
Add this Action to your TIL repo. Here's an example:
name: Build README
on:
push:
branches:
- master
paths-ignore:
- README.md
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
# necessary for github-action-til-autoformat-readme
fetch-depth: 0
- name: Autoformat README
uses: cflynn07/[email protected]
with:
description: |
A collection of concrete writeups of small things I learn daily while working
and researching. My goal is to work in public. I was inspired to start this
repository after reading Simon Wilson's [hacker new post][1], and he was
apparently inspired by Josh Branchaud's [TIL collection][2].
footer: |
[1]: https://simonwillison.net/2020/Apr/20/self-rewriting-readme/
[2]: https://github.com/jbranchaud/til
list_most_recent: 2 # optional, lists most recent TILS below description
date_format: "2020 Jan 15:04" # optional, must align to https://golang.org/pkg/time/#Time.Format
You can see an example of a sample TIL repo with the action here:
cflynn07/til-autoformat-action-example
# TIL
> Today I Learned
A collection of concrete writeups of small things I learn daily while working
and researching. My goal is to work in public. I was inspired to start this
repository after reading Simon Wilson's [hacker new post][1], and he was
apparently inspired by Josh Branchaud's [TIL collection][2].
_3 TILs and counting..._
---
### 2 most recent TILs
- [How to add a CSS border](css/how-to-add-a-border.md) - Sat Apr 25 19:39:03 2020 +0800
- [How to make a div](html/how-to-make-a-div.md) - Sat Apr 25 17:53:55 2020 +0800
### Categories
- [css](#css)
- [html](#html)
- [k8s](#k8s)
### [css](#css)
- [How to add a CSS border](css/how-to-add-a-border.md)
### [html](#html)
- [How to make a div](html/how-to-make-a-div.md)
### [k8s](#k8s)
- [how to blow up a k8s cluster](k8s/how-to-blow-up-a-cluster.md)
[1]: https://simonwillison.net/2020/Apr/20/self-rewriting-readme/
[2]: https://github.com/jbranchaud/til