Skip to content

Commit 36fbbff

Browse files
committed
api-request: request a specific GitHub REST API version
We just got surprised with a failure due to an update in the API version: When triggering workflows, the `return_run_details` flag, which used to be required, now triggers an error. Let's avoid getting such nasty surprises by specifying which API version we target. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent bf5b8e5 commit 36fbbff

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎GitGitGadget/github-api-request-as-app.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const gitHubAPIRequestAsApp = async (context, requestMethod, requestPath, body)
3838
body,
3939
{
4040
Authorization: `Bearer ${token}`,
41+
'X-GitHub-Api-Version': '2026-03-10',
4142
}
4243
)
4344
}

‎GitGitGadget/github-api-request.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const gitHubAPIRequest = async (context, token, method, requestPath, payload) => {
22
const { httpsRequest } = require('./https-request')
3-
const headers = token ? { Authorization: `Bearer ${token}` } : null
3+
const headers = {
4+
'X-GitHub-Api-Version': '2026-03-10',
5+
...(token ? { Authorization: `Bearer ${token}` } : {}),
6+
}
47
const answer = await httpsRequest(context, null, method, requestPath, payload, headers)
58
if (answer.error) throw answer.error
69
return answer

0 commit comments

Comments
 (0)