Work around the shallow checkout behavior of `release_ruleset.yaml`[^1]

We need the full history of commits and tags to generate release notes.

[^1]: While https://github.com/actions/checkout/blob/main/action.yml supports deep checkouts, we can't pass parameters to it unless https://github.com/bazel-contrib/.github/blob/master/.github/workflows/release_ruleset.yaml exposes a parameter for it.

(ignore-relnotes)

PiperOrigin-RevId: 874550299
Change-Id: I498f09063adaebb0d0709f1cebdfc9b0067215ae
diff --git a/distro/relnotes.bzl b/distro/relnotes.bzl
index 9c0806a..e47c3c9 100644
--- a/distro/relnotes.bzl
+++ b/distro/relnotes.bzl
@@ -5,6 +5,7 @@
         name = name,
         outs = [name + ".txt"],
         cmd = """
+              [ "$$(/usr/bin/git rev-parse --is-shallow-repository)" == "true" ] && /usr/bin/git fetch --unshallow
               last_rel=$$(git describe --tags --abbrev=0 HEAD~1)
               changelog=$$(/usr/bin/git log tags/$$last_rel..HEAD --format=oneline --invert-grep --grep 'ignore-relnotes' --)
               sha=$$(/usr/bin/sha256sum $(SRCS) | cut -d ' '  -f1)