I just set up a self-hosted GitHub Actions runner in my homelab and wrote about it in my self-hosted blog! This is my second blog entry, so I would really appreciate any feedback or suggestions to help improve my writing is more than welcome.
My main reason was honestly laziness 😅 . I just went with what was quickest to set up. I also hadn’t realiced I could have two upstreams on my repo: one public-facing on GitHub (because I’m still in college and trying to build in public for future job opportunities) and another self-hosted on Gitea or GitLab for CI/CD.
That actually sounds like a great setup, so I’ll definitely look into it now. Thanks for the recommendation!
actions/setup-java@v4 would fail trying to find the java setup script at Forgejo's runner source repo, and apparently it wasn't there when I went to look. I'll look at it another time when maybe all the backend is put together or there's a way I can host the actions locally so I'm not relying on outside sources that might pollute my CI output.
I can't find it right now, but there used to be a warning about not self-hosting runners for public repos. Anyone could fork your repo, and the fork would inherit your runners, and then they could change the pipeline to RCE on your runner.
Has that been fixed?
I went to a completely private gitlab instead, with mirroring up to github for anything that needed to be public.
Edit: seems to maybe not be an issue anymore, at the very least it doesn't seem to affect that repo. Still, for anyone else, make sure forks and MRs can't cause action to run automatically on your runner, because that would be very bad.
There is no auth needed for gh runners? Like a secret shared between them and the repo? I would guess repo secrets are not shared when forked... right?
The other potential risk is that the github action author maliciously modifies their code in a later version, but that is solved with version pinning the actions.
I also thought this wasn’t an issue anymore, there’s a setting in the Actions settings where you can enable or disable workflows from forked pull requests. But someone on Reddit spooked me a bit about it, so for now, I’ve made the repo private until I’m 100% sure there are no risks.
I wanted it public because I was considering using GitHub Issues as a backend for blog comments, but I’ll reevaluate that. Also, thanks for the idea of running a local git server with mirroring to GitHub—I hadn’t considered having two upstreams. That could be a great setup, especially since I’m still in college and trying to build in public for future job opportunities while keeping CI/CD self-hosted.
I did create a fork and MR, and neither used your runner (sorry if that is what spooked you).
Develop local and push remote also let's you sanitize what is public and what isnt. Keep your half-backed personal projects local, push the good stuff to github for job opportunities.
Basically, I just wanted to tinker and learn. Self-hosting my CI/CD pipeline seemed like an interesting approach, and I wanted to explore how it all works beyond just using GitHub’s free runners.