fix(github): silence contents endpoint deprecation warnings

Use RFC 6570 reserved expansion ({+path}) so slashes stay literal in
the request URL, and pin the contents call to API version 2026-03-10
to clear the Sunset: 2028-03-10 header on the deprecated 2022-11-28
version. The only breaking change in 2026-03-10 (submodule type in
directory listings) doesn't affect us — fetchLatestSha is per-file
and the array branch already short-circuits.
This commit is contained in:
Julien Calixte
2026-05-17 00:34:03 +02:00
parent e11609990d
commit 7a2ccc1bd1

View File

@@ -15,12 +15,12 @@ export const useGitHubContent = ({
try { try {
const octokit = await getOctokit() const octokit = await getOctokit()
const response = await octokit.request( const response = await octokit.request(
"GET /repos/{owner}/{repo}/contents/{path}", "GET /repos/{owner}/{repo}/contents/{+path}",
{ {
owner: user, owner: user,
repo, repo,
path, path,
headers: { "X-GitHub-Api-Version": "2022-11-28" } headers: { "X-GitHub-Api-Version": "2026-03-10" }
} }
) )
const data = response?.data const data = response?.data
@@ -44,7 +44,7 @@ export const useGitHubContent = ({
const octokit = await getOctokit() const octokit = await getOctokit()
const response = await octokit.request( const response = await octokit.request(
`PUT /repos/{owner}/{repo}/contents/{path}`, "PUT /repos/{owner}/{repo}/contents/{+path}",
{ {
owner: user, owner: user,
repo, repo,