DEV Community

Cover image for Skipping GitHub Actions jobs without breaking branch protection
Benjy Weinberger
Benjy Weinberger

Posted on

Skipping GitHub Actions jobs without breaking branch protection

GitHub Actions is a wonderful service, but configuring it can be a bit of a challenge. This is especially true when it comes to conditional logic, such as skipping jobs that aren't needed for a specific pull request.

We recently moved our project's documentation into the repo, so that docs changes now undergo review (which is great!) and trigger a full CI run (which is not so great...)

It took a few iterations to figure out how to configure GitHub Actions to skip the heavyweight CI jobs, like running tests, when a PR only affects documentation. This was especially tricky because we have branch protection rules in place to prevent merges into main of PRs whose CI has not passed.

You can read more about the hackery we employed to get this working here.

PS Feel free to reach out on Slack if you want to learn more about Pants and its support for Python, Go, JVM, Shell and more.

Top comments (0)