How to skip build and deploy for GitHub Pages

The problem

For a recent project, I was trying to add the [skip ci] keyword to my Git commit messages to avoid the build process as documented by GitHub. This was for my blog, which was hosted on GitHub pages at the time. However, despite using the [skip ci] keyword, every commit was retriggering a build. Notice the build status besides each commit.

As you can imagine, that’s an inefficient use of resources, especially since these commits were changing draft file contents which have no repercussions on the build step.

Deploy from branch vs Deploy from GitHub Actions

I hypothesized that the [skip ci] keyword only applied to typical GitHub actions workflow file, so I went to verify my config. That’s when I noticed that I in fact didn’t have a workflow file. Rather I was using the GitHub Pages’ Deploy from branch (Classic Pages experience) feature.

Naturally, I decided to toggle my Pages source to a workflow file to see if it would resolve my issue. GitHub Pages makes it quite easy, providing a workflow file based off of your configuration.

After making a new commit, I noticed that, indeed, my commits are no longer triggering a build. Problem solved!

In conclusion, it seems that GitHub Pages Deploy from branch source does not support these [skip ci] keywords, whereas typical GitHub Actions do, so setting up a GitHub Pages source of GitHub Actions will work.

TLDR

[skip ci] is not supported for GitHub Pages Deploy from branch source, change your GitHub Pages source to a workflow file to resolve it.