Why

The Github process for building Jekyll websites is pretty simple and straight forward: The code is pushed to the remote repository and Github automatically rebuild the website.

For some unknown reasons (at least to me at the time of writing this note) Github doesn’t rebuild the site despite new commits being added to the repository.

How to

Using Github API, we can queue a request for a force rebuild.

Using Personal Access Token

We can use the following command with USERNAME being replaced by the Github username, the REPOSITORY_NAME (self explanatory) and PERSONAL_TOKEN being replaced by a Github “Personal Access Token”

curl -X POST \
--header "Authorization: token PERSONAL_TOKEN" \
'https://api.github.com/repos/USERNAME/REPOSITORY_NAME/pages/builds'

Personal Access Tokens are the easiest way to authenticate requests as a GitHub user. You can create a new Personal Access Token at https://github.com/settings/tokens/new.

In the scope, select public_repo scope which is what is needed in this specific case, e.g. to retrieve, create or update all things related to repositories.

Using Github Password

We can also queue our rebuild using our Github password with the following command with USERNAME being replaced by the Github username and PERSONAL_TOKEN by the repository name

curl -X POST  \
--header 'Accept: application/vnd.github.mister-fantastic-preview+json' \
-u 'USERNAME' 'https://api.github.com/repos/USERNAME/PERSONAL_TOKEN/pages/builds'

This will prompt for the Github password

The response from Github API will be a JSON payload like the following