Skip to content

feat: use GitHub Git Refs API for efficient tag validation#296

Open
suztomo wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
suztomo:git_ref_api
Open

feat: use GitHub Git Refs API for efficient tag validation#296
suztomo wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
suztomo:git_ref_api

Conversation

@suztomo
Copy link
Contributor

@suztomo suztomo commented Dec 26, 2025

Replaced the 1100-tag scan with a direct lookup using the Git Refs API.
This resolves flakiness for large repositories like Genkit and improves
efficiency by reducing the number of API calls.

b/440379162

GitHub API is lenient about the URL encoding

I thought about whether GitHub API needs URL encoding for the tags that have "@" character. It turned out it's not needed.

GitHub API not requiring URL encoding
suztomo@suztomo:~/b468377909/wombat-dressing-room$ gh api --verbose "/repos/firebase/genkit/git/ref/tags/genkitx-pinecone@1.27.0-rc.2"
* Request at 2025-12-26 18:16:01.080415371 +0000 UTC m=+0.085464534
* Request to https://api.github.com/repos/firebase/genkit/git/ref/tags/genkitx-pinecone@1.27.0-rc.2
> GET /repos/firebase/genkit/git/ref/tags/genkitx-pinecone@1.27.0-rc.2 HTTP/1.1

...

{
  "ref": "refs/tags/genkitx-pinecone@1.27.0-rc.2",
  "node_id": "REF_kwDOL1BamNoAJnJlZnMvdGFncy9nZW5raXR4LXBpbmVjb25lQDEuMjcuMC1yYy4y",
  "url": "https://api.github.com/repos/firebase/genkit/git/refs/tags/genkitx-pinecone@1.27.0-rc.2",
  "object": {
    "sha": "22a48d246bf301448ab775094af9df35dcb9f14a",
    "type": "commit",
    "url": "https://api.github.com/repos/firebase/genkit/git/commits/22a48d246bf301448ab775094af9df35dcb9f14a"
  }
}

* Request took 152.090625ms

Replaced the 1100-tag scan with a direct lookup using the Git Refs API.
This resolves flakiness for large repositories like Genkit and improves
efficiency by reducing the number of API calls.

BUG=440379162
@suztomo suztomo marked this pull request as ready for review December 26, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant