Github and Local Runners

Using github when coding is a lifesaver, both for work and private projects. Most of my own projects are private repo’s, and it makes it easy to jump in and do changes where ever you are.

One of the projects is a python script that connects to my smart home solution Home Assistant, and generates a html page that is disabled in our living room with temperatures, calendar appointments, weather etc.

When editing this python script, I’ve needed to log into the server and do a git pull, so I always have the latest version. Yes I could use a cronjob or something to do it regular but Github and local runners makes it sooo easy.

Under your repo at Github, choose settings, actions and runners. Here you choose OS, and a step by step guide is generated for you. This installs the local runner on the machine you want, connected to you repo ready for action.

My way to do this is not advanced, a small Action in
Github and a local bash script with “git pull https://apikey@github.com/blablabla/repo.git”

The Action in Github is based on the example file:

# This is a basic workflow that is manually triggered
name: test
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  push:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  deployment:
    runs-on: self-hosted
    steps:
    # Runs a single command using the runners shell
    - name: Send greeting
      working-directory: /home/user/folder/
      run: ./bash_script