simonw / til

Today I Learned
https://til.simonwillison.net
Apache License 2.0
1.02k stars 81 forks source link

GitHub Action which updates the README for me when I add a new TIL #1

Closed simonw closed 4 years ago

simonw commented 4 years ago

I want the README to link to all of the TILs.

simonw commented 4 years ago

I'm going to build and deploy a SQLite database too.

simonw commented 4 years ago

I have the script now. Next step: build it into action which then pushes a commit to the repo with the updated README.

Need to make sure that the commit triggered by the action doesn't cause a new action run.

simonw commented 4 years ago

It worked! https://github.com/simonw/til/commit/897ac314bef560615c35a14ac787880c0a850f50

simonw commented 4 years ago

Last test: add a new TIL and see if it updates the README and deploys to Now.

simonw commented 4 years ago

https://github.com/simonw/til/commit/89e810edb3f345339272464ea0fd0b91d9f94aad didn't update the README for some reason.

https://github.com/simonw/til/runs/599796757?check_suite_focus=true

simonw commented 4 years ago

This is weird: https://github.com/simonw/til/runs/599813070?check_suite_focus=true

diff --git a/README.md b/README.md
index b7c3739..d186d07 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ My Today I Learned snippets. Inspired by [jbranchaud/til](https://github.com/jbr
 * [Only run GitHub Action on push to master](https://github.com/simonw/til/blob/master/github-actions/only-master.md) - 2020-04-19
 * [Dump out all GitHub Actions context](https://github.com/simonw/til/blob/master/github-actions/dump-context.md) - 2020-04-19
 * [Set environment variables for all steps in a GitHub Action](https://github.com/simonw/til/blob/master/github-actions/set-environment-for-all-steps.md) - 2020-04-19
+* [Commit a file if it changed](https://github.com/simonw/til/blob/master/github-actions/commit-if-file-changed.md) - 2020-04-19

 ## python

Everything up-to-date

Why does it say Everything up-to-date when git diff clearly shows changes?

simonw commented 4 years ago

Oh! It's because I ran git add before that git diff:

        git add README.md
        git diff --quiet || git commit -m "Updated README"
        git push
simonw commented 4 years ago

Still not quite working right. https://github.com/simonw/til/runs/599821875?check_suite_focus=true broke:

Install_datasette-render-markdown_·_simonw_til_f5df21e

simonw commented 4 years ago

It's working now.