diff --git a/.github/workflows/tapioca.yml b/.github/workflows/tapioca.yml
index 9685d0b93154026a491244f84366998223e22373..56c24fbb13471936d6d823fca3967410ca782cf7 100644
--- a/.github/workflows/tapioca.yml
+++ b/.github/workflows/tapioca.yml
@@ -35,16 +35,17 @@ jobs:
         run: |
           cd "$GITHUB_WORKSPACE/Library/Homebrew"
 
+          git fetch origin master
+          git reset --hard origin/master
+          git checkout -B tapioca-update
+
           # TODO: replace with `brew typecheck`
           bundle exec tapioca sync --exclude json
           bundle exec srb rbi hidden-definitions
 
-          git fetch origin master
-          git reset --hard origin/master
-          git checkout -B tapioca-update
-          git add sorbet
-          if ! git diff --no-patch --exit-code HEAD -- sorbet; then
+          if ! git diff --no-patch --exit-code -- sorbet; then
             if ! git ls-remote --exit-code --heads origin tapioca-update >/dev/null; then
+              git add sorbet
               git commit -m "sorbet: update RBI files using Tapioca." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/tapioca.yml)."
               echo "::set-output name=committed::true"
             fi