fix(github): send User-Agent header on GitHub API requests

GitHub rejects API requests without a User-Agent (403), and Workers'
fetch does not set one by default, so workflow job enrichment and
check-suite build-log lookups silently failed in production.
This commit is contained in:
RhenCloud committed 2026-09-26 16:02:27 +08:00
1 parent 027ca2bcca
commit 2891e1f33c
4 files changed
+29 -2

No files matched your search

+2
View File
@@ -1,6 +1,7 @@
import { createAppJwt } from "./oauth";
export const GITHUB_API_VERSION = "2022-11-28";
export const GITHUB_USER_AGENT = "WebHooker (https://github.com/ReCloudStudio/WebHooker)";
/**
* Mint a short-lived installation access token for a GitHub App installation.
@@ -23,6 +24,7 @@ export async function getInstallationToken(
Authorization: `Bearer ${jwt}`,
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": GITHUB_API_VERSION,
"User-Agent": GITHUB_USER_AGENT,
},
},
);