Manually Triggering Github Actions

programming
Published

October 25, 2020

I have been publishing this website using Github Actions with Hugo on push and on a daily schedule. I recently received an error notification via email from Github, and wanted to check whether it was an intermittent error. Unfortunately I couldn’t find anyway to rerun it manually; I would have to push again or wait. Fortunately there’s a way to enable manual reruns with workflow_dispatch.

There’s a Github blog post on enabling manual triggers with workflow_dispatch. Essentially you just have to add workflow_dispatch to the on sections in the workflow yaml. Once this is done then there’s a UI element on the Workflow in the Actions section in Github that lets you “Run Workflow”.

Github Workflow Dispatch

Here’s how my workflow on section looks now, having added the last line to allow workflow_dispatch.

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    - cron: '4 22 * * *'
  workflow_dispatch: