Fix up staleness check
diff --git a/.github/workflows/staleness_check.yml b/.github/workflows/staleness_check.yml
index d5c1a65..b11cdd5 100644
--- a/.github/workflows/staleness_check.yml
+++ b/.github/workflows/staleness_check.yml
@@ -38,7 +38,7 @@
       - name: Checkout ${{ matrix.branch }}
         uses: protocolbuffers/protobuf-ci/checkout@v3
         with:
-          ref: ${{ inputs.safe-checkout || matrix.branch }}
+          ref: ${{ inputs.safe-checkout || github.head_ref || matrix.branch }}
 
       - name: Mark runs associated with commits
         if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}