Skip to content

Commit

Permalink
specify REST API version 2022-11-28
Browse files Browse the repository at this point in the history
> You must specify which REST API version to use whenever you make a request to the REST API.

https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022-11-28
  • Loading branch information
shogo82148 committed Jul 5, 2023
1 parent c1e1c98 commit fcbd849
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/create-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ async function readFile(path: string): Promise<string> {
const newGitHubClient = (token: string): http.HttpClient => {
return new http.HttpClient("shogo82148-actions-create-release/v1", [], {
headers: {
Authorization: `token ${token}`,
Accept: "application/vnd.github.v3+json",
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
},
});
};
Expand Down
9 changes: 5 additions & 4 deletions src/publish-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export async function publish(opt: Options): Promise<void> {
const newGitHubClient = (token: string): http.HttpClient => {
return new http.HttpClient("shogo82148-actions-create-release/v1", [], {
headers: {
Authorization: `token ${token}`,
Accept: "application/vnd.github.v3+json",
Authorization: `Bearer ${token}`,
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
},
});
};
Expand All @@ -53,8 +54,8 @@ interface ReposUpdateReleaseParams {
make_latest?: MakeLatest | undefined;
}

// minium implementation of create a release API
// https://docs.github.com/en/rest/reference/repos#create-a-release
// minium implementation of update a release API
// https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#update-a-release
const updateRelease = async (params: ReposUpdateReleaseParams): Promise<void> => {
const client = newGitHubClient(params.github_token);
const raw: { [key: string]: string | boolean } = {
Expand Down

0 comments on commit fcbd849

Please sign in to comment.