Avoiding double builds in GitHub Actions

I was recently setting up some CI on GitHub Actions and ran across double builds for pull requests. The official documentation is still a bit lacking and it's a problem because it burns 2x the credits.

In the end, I made this diff:

-on: [push, pull_request]
+on:
+  pull_request:
+  push:
+    branches:
+      - master

This runs the GitHub Action on all PRs and the master branch. If you've got staging or dev branches, you'll want to add them too.

Subscribe to Daniel Lockyer

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe