News for hackers. Stuff that matters.
Re:Doing stupid stuff with GitHub Actions by simonw on Saturday July 25, 2020 @04:57PM (#23952359)
I really enjoyed Jonty Wareing's hack recently where he built a static site generator inside a GitHub Action that works by doing the following:

1. Spin up a Python Flask web server on localhost

2. Run "wget --mirror" against it to crawl the site and save it as static files

3. Publish the resulting static files to GitHub Pages

The workflow is here. It's genius: https://github.com/pubstandards/pubstandards-london/blob/899...

Re:Doing stupid stuff with GitHub Actions by spalas on Saturday July 25, 2020 @05:08PM (#23952438)
Love it!

I have seen people doing fun things with GitHub Actions for the new GitHub profile readme feature as well.

This community chess game is one of my favorites https://github.com/timburgan/timburgan

It uses the creation GitHub issues on the repo as the input method/trgger which is a pretty clever hack.

Re:Doing stupid stuff with GitHub Actions by simonw on Saturday July 25, 2020 @05:14PM (#23952487)
Yeah I have an article about profile README hacks using Actions here: https://simonwillison.net/2020/Jul/10/self-updating-profile-...
Re:Doing stupid stuff with GitHub Actions by spalas on Saturday July 25, 2020 @05:18PM (#23952515)
Oh nice, I saw that one on the front page the other day.

Didn't realize it was you -- great post!

Re:Doing stupid stuff with GitHub Actions by neurostimulant on Saturday July 25, 2020 @07:01PM (#23953056)
Instead of wget-ing localhost, maybe it's better to use Frozen-Flask[1] instead. I use it to implement my own static site generator for my personal website and it's working great.

[1] https://pythonhosted.org/Frozen-Flask/

Re:Doing stupid stuff with GitHub Actions by yebyen on Sunday July 26, 2020 @02:30PM (#23959067)
That sounds too straightforward, therefore not worth as many internet points...

(Thanks that's a nice share!)

Re:Doing stupid stuff with GitHub Actions by thom on Saturday July 25, 2020 @05:48PM (#23952675)
Heh, I worked on a site for a brand during the 2006 World Cup that did basically exactly this (although a PHP site, and a slightly rickety manual build process). They had bought pitchside advertising to be shown during the final, and anticipating enormous traffic which sadly never materialized. But we totally could have handled it!

Other over-optimisations on the same project included going all the way and including functionality to handle drawn lots as tie-breakers. This also never happened.

Re:Doing stupid stuff with GitHub Actions by jcun4128 on Monday July 27, 2020 @05:07PM (#23969391)
I was trying to look into GitHub actions but didn't really understand it. I just straight up called CLI commands eg. $git commit -m "..." and ran those after I put a key(in my case on a pi) and it does commits by CRON. I was just publishing sensor data to my GitHub readme. But it's cool that it works.
Re:Doing stupid stuff with GitHub Actions by gjulianm on Saturday July 25, 2020 @05:05PM (#23952416)
It's not often that I see things that are stupid but smart at the same time, so cool!
Re:Doing stupid stuff with GitHub Actions by buzzerbetrayed on Saturday July 25, 2020 @06:47PM (#23952983)
Genuine question: what is smart about this? What is the reasoning for not just writing the static assets by hand?
Re:Doing stupid stuff with GitHub Actions by simonw on Saturday July 25, 2020 @07:02PM (#23953060)
The site already existed, but they wanted to serve it statically to save on complexity and money.

If you dig into the repo you'll see that it's maintained using a YAML file, which is a smart way to deal with small sites that still contain structured content.

I do the same thing for my https://github.com/simonw/museums site.

Re:Doing stupid stuff with GitHub Actions by withinboredom on Saturday July 25, 2020 @06:53PM (#23953016)
Some possibilities come to mind:

1. because the people writing the content are not developers. 2. there’s dynamic content, but when you know you’re going to get a large influx of traffic from a single region/event, you can precompute it for a short period.

Re:Doing stupid stuff with GitHub Actions by gjulianm on Saturday July 25, 2020 @08:03PM (#23953312)
It's smart because it's a solution to a problem (freezing dynamic content) in one line of code, the wget command. It should work for most cases and it's easy to understand and deploy.