
Doing stupid stuff with GitHub Actions - spalas
https://devopsdirective.com/posts/2020/07/stupid-github-actions/
======
simonw
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...](https://github.com/pubstandards/pubstandards-
london/blob/89989bd3e3e2391425bc8e76055e90892635ec5a/.github/workflows/build.yml)

~~~
spalas
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](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.

~~~
simonw
Yeah I have an article about profile README hacks using Actions here:
[https://simonwillison.net/2020/Jul/10/self-updating-
profile-...](https://simonwillison.net/2020/Jul/10/self-updating-profile-
readme/)

~~~
spalas
Oh nice, I saw that one on the front page the other day.

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

------
davnicwil
For anybody interested in playing around with and hacking on different CI /
devops stuff I recently launched [https://boxci.dev](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 around with it, and I'd love to get the feedback
of any HNs who think this could be useful (I basically built it because it's
the CI service I want to exist, and I think others might too).

~~~
oars
This looks awesome.

As someone who's a bit newer to CI/CD, this solution would be ideal if you
don't want to host Jenkins yourself right?

I just give you access to my GitHub repos, install the agent then whenever I
commit something into GitHub, the agent will see this and perform the
task/pipeline right?

Similarly to how Jenkins works, except I don't need to install Jenkins - I
just install the agent instead.

~~~
davnicwil
Exactly right!

And just to emphasise, even the agents are totally ephemeral and don't require
much management effort on your side - you can install and spin them up/down on
any machine at any time just through shell commands and the service
automatically manages this agent pool and sends builds to it - no manual steps
at all. If no agents are running, builds just sit in a queue.

If you'd be interested in playing around with it and have any questions,
please feel free to email me (email's in my profile).

------
caiobegotti
The "Holiday Reminder" could actually send a somewhat puzzling notification
about you needing to check out the GitHub pipeline for a production failure. I
would for sure forget about even setting it up and would shit my pants on New
Year's Eve... and then have a good laugh on myself.

~~~
spalas
Haha, good point... I have another 5 months to fully forget that I ever set
this up.

The name of the action does get included in the email notification so
hopefully I'll be able to decypher it, even after some NYE celebration
champagne!

~~~
KarlKode
You could set up a weekly failing job that reminds you ;)

------
TedDoesntTalk
I rarely see a sense of humor on HN. It’s a nice surprise and I hope to see
more of it. Nice job!

~~~
spalas
I'm glad you enjoyed it!

I figured if I was going to learn a new tool, I might as well have some fun
along the way!

------
ihaveajob
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.

~~~
spalas
Haha - We have it too easy these days and can just spin up a VM with Virtual
Box (or similar) to test stuff like this.

------
swyx
I've used GH Actions to replicate LinkedIn's Endorsements feature on their new
Profile Readme feature: [https://github.com/sw-yx/sw-
yx](https://github.com/sw-yx/sw-yx)

------
geokon
Unlike the authoer, I haven't found Github Actions very intuitive to work with
:)

I've asked this before on a similar post, maybe someone here knows. Has anyone
managed to get a Pre-Release to track Master using Github Actions? I can't
seem to find a working example that does this (and I can't seem to cobble one
together myself)

There are a few things that are seemingly intentionally left out of GitHub
Actions... like you can create new Releases on a push, but there is no direct
way to delete/update a release with fresh builds.

I know you can just get build artifacts - but those are not publicly available
and hard to link people to.

~~~
spalas
I think you could build on this action [https://github.com/actions/github-
script/](https://github.com/actions/github-script/) which provides a JS client
for the GitHub API.

It looks like it supports all of the API routes you would need including:

[https://github.com/actions/github-
script/blob/b507739f17c210...](https://github.com/actions/github-
script/blob/b507739f17c2106b2a1a596000eaa49a0d5c33a2/dist/index.js#L9514)

To actually perform the release update.

~~~
geokon
it's strange to me this isn't a first class feature

Thanks for the tip. I don't really know JS so I may dig into this if it
becomes a major burden. For the time being I'll just manually delete the
prerelease between pushes

------
smichel17
Alternative idea for exponential action: action that creates another action
(automate a headless browser, or maybe github has an api for that?). Kill
switch: delete the repo :)

------
Nekorosu
The real question is, are Github Actions Turing complete?

~~~
chrisseaton
Yes you can run arbitrary code in them.

------
darekkay
With the new GitHub profile README feature, GitHub Actions gained a lot of
traction. I'm using it to automatically display my latest blog post [1].

[1] [https://darekkay.com/blog/github-profile-
readme/](https://darekkay.com/blog/github-profile-readme/)

------
tarulahsan
I was reading all the comments and found it really interesting. Thanks for the
post.

------
stevehiehn
I work on a product similar to Github Actions:
[https://cto.ai/](https://cto.ai/) but there is a built in interaction layer
for interacting from Slack channels.

------
jcun4128
nice site, it's clean

~~~
benatkin
It's nice but it could be cleaner, by dropping the sidebar, and constraining
the width of prose. See "Why is the text on your site so narrow? It wastes
screen space." here:
[http://www.paulgraham.com/gfaq.html](http://www.paulgraham.com/gfaq.html)

~~~
0xbkt
Is it any better to use images for styling buttons instead of CSS?

