Live data from Hacker News

Doing stupid stuff with GitHub Actions

devopsdirective.com

21–30 of 46 posts

Re: Doing stupid stuff with GitHub Actions

#21
post #7

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/…

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

#23

For anybody interested in playing around with and hacking on different CI / devops stuff I recently launched https://boxci.dev , which is a distributed CI service where the builds run on your own hardware, via a lightweight runner that just does coordination and runs build shell commands on bare metal, so it's a bit more hackable / flexible than (for instance) GH actions / Gitlab CI. It's free to sign up and play aro…

neat. Looks similar to https://buildkite.com .

Re: Doing stupid stuff with GitHub Actions

#24

For anybody interested in playing around with and hacking on different CI / devops stuff I recently launched https://boxci.dev , which is a distributed CI service where the builds run on your own hardware, via a lightweight runner that just does coordination and runs build shell commands on bare metal, so it's a bit more hackable / flexible than (for instance) GH actions / Gitlab CI. It's free to sign up and play aro…

> where the builds run on your own hardware

This is possible with GitHub Actions, too: https://docs.github.com/en/actions/hosting-your-own-runners/... (the place I work at uses it.)

Re: Doing stupid stuff with GitHub Actions

#25
post #9
post #7

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/…

It's not often that I see things that are stupid but smart at the same time, so cool!

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

#26
post #9

Earlier quoted context omitted.

It's not often that I see things that are stupid but smart at the same time, so cool!

Genuine question: what is smart about this? What is the reasoning for not just writing the static assets by hand?

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

#27
post #7

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/…

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

#28
post #9

Earlier quoted context omitted.

It's not often that I see things that are stupid but smart at the same time, so cool!

Genuine question: what is smart about this? What is the reasoning for not just writing the static assets by hand?

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

#29
Reminds me of my first year in college, when we'd log into each other's machines at the computer lab for some intro to computing class, and launch a fork-bomb script that simply launched itself twice, quickly rendering the machine useless. The tricky part was to test it without halting your own machine, as a newbie programmer and Unix user.

Re: Doing stupid stuff with GitHub Actions

#30
post #9

Earlier quoted context omitted.

It's not often that I see things that are stupid but smart at the same time, so cool!

Genuine question: what is smart about this? What is the reasoning for not just writing the static assets by hand?

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.
Post reply on HN