A brief experience with GitHub Actions and CatLight

After deciding I couldn’t get the URLs I wanted for my blog using Cloudflare Pages without some actual real honest-to-goodness rewrites I had to use GitHub Actions for the first time in anger.

An incredibly powerful platform with a misery-inducing YAML syntax. Little more to be said.

What was nice was the chance to use CatLight for the first time since reading about it a few years ago when Matthew Somerville first mentioned it. At the time he needed to write some code to make the output from GitHub Actions available, but happily this is now built-in and so whilst iterating on my YAML mistakes I was getting nice desktop notifications about it.

I don’t get the chance to write much code any more, but tooling that makes it easier to follow the process from local commit to being aware of whether your commit has worked is always a benefit.

57 days

Yesterday, with the return of my family from holiday, I forgot to make changes to any of my projects in GitHub, and broke my commit streak at 57 days.

Initially I’d aimed for making changes on 30 consecutive days, just to try and get some momentum up in making progress on a couple of fairly low-key projects that hadn’t been going anywhere, and although I did cheat a few times (GitHub counts things like opening issues on a repo as ‘activity’ and I have plenty of bugs and features!), the vast majority of my activity was real commits, and I found 30 to be quite easy.

I think this is definitely something I’ll try again, but probably in 30-day chunks (each day only tends to give me ~30 minutes free to do any coding at home!), and probably with a more well-defined plan about what I’m actually expecting myself to ship within that time.

Anyway, despite the fact that I’ve finally broken my run, I’m pleased that I managed to get so much higher than I’d originally aimed for. Onwards!

How to push to two servers at once with git

As I said this time last year, I dislike the idea of people using a decentralised version control system to centralise their code.

This means that some of my code sits in Bazaar on my server, some in Git on my server, and some in github. I’m not keen on this situation, and given that github does have a large amount of mindshare, and that launchpad is really quite horrible to use, I want to be able to “git push” to both my server and github at the same time.

It turns out this is quite easy; and everything below (with a few very minor modifications) comes from “Setting up a new remote git repository” by Tim Lucas and Aristotle Pagaltzis‘ answer on this Stackoverflow question.

So, given that I have a working github repo, and a local checkout:

Set up the new bare repo on the server:

$ ssh myserver.com
$ mkdir /var/git/myapp.git
$ cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
$ exit

Add the remote repository to your existing local git repo and push:

$ cd ~/code/myapp
$ git remote add myserver ssh://myserver.com/var/git/myapp.git
$ git push myserver master

You have now associated the remote repo with your local repo under the name “myserver”. Now open up ~/code/myapp/.git/config and:

put something like this:

[remote "public"]
    url = git@github.com:username/myapp.git
    url = ssh://myserver.com/var/git/myapp.git

Now you can say “git push public” to push to both repos at once.

and that’s it! Every time you push you will be making sure that your code lives on both your server and on github. Adds links to both in your README and the job is complete.