Is there any way to see the current target SHA of a GitHub repository submodule via Octokit[.net] (without cloning it locally)?
I've been able to track down all the submodules by retrieving the .gitmodules file from the "parent" repo, but that file doesn't maintain where the submodule is pointing with in that submodule repo.
Prior attempts
After finding someone getting this information by indexing into a commit by the submodule path using LibGit2Sharp, I gave that a similar try in Octokit.
var submodulePathContents = await repositoriesClient.Content.GetAllContents(parentRepoId, "path/to/submodule");
While stepping through this code in the debugger, I see this in Locals/Autos, so it definitely knew I was pointing it to a submodule path.
System.Collections.Generic.IReadOnlyList.this[int].get Name: mono-tools Path: path/to/submodule Type:Submodule Octokit.RepositoryContent
Unfortunately, when I get the actual content from that list, submodulePathContents[0].Content
is just null
.
The GitHub web interface definitely surfaces this information when you navigate to a submodule's parent directory, so it makes me think I've just tried the wrong approach.
Is there some other magic way in the Octokit APIs that I've missed to get this submodule target hash?