Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new version field to GitHub API requests #635

Open
robdimsdale opened this issue Nov 30, 2022 · 2 comments
Open

Add new version field to GitHub API requests #635

robdimsdale opened this issue Nov 30, 2022 · 2 comments
Labels
good first issue A good first issue to get started with hacktoberfest Hacktoberfest eligible

Comments

@robdimsdale
Copy link
Member

In a recent blog post GitHub announced a new API versioning scheme.

TL;DR - we should add: X-GitHub-Api-Version: 2022-11-28 to all REST API calls. In the future when new versions of the API are released, we can evaluate if we want to bump to that new version.

@robdimsdale
Copy link
Member Author

It looks like recent versions of the gh cli will automatically add this HTTP header for us. Presumably the CLI will also know which version of an API to use for a given command once GitHub supports multiple versions of the API.

Therefore I think we should strongly consider using the gh CLI (instead of e.g. curl) everywhere we make GitHub API requests.

Example CLI request:

❯ DEBUG=api gh auth status
[ ... request headers ... ]

< HTTP/2.0 200 OK
[ ... response headers ... ]
< X-Github-Api-Version-Selected: 2022-11-28
[ ... ]

@robdimsdale robdimsdale added the good first issue A good first issue to get started with label Mar 20, 2023
@robdimsdale
Copy link
Member Author

As a first step, I think there is no reason we should not use gh instead of curl inside of actions. It is easier to use and is generally available in all images that actions run on.

We can push out the conversation of using gh in scripts that run on local workstations as well as in CI, as that would require users to install gh which would be a breaking change in the UX.

@sophiewigmore sophiewigmore added the hacktoberfest Hacktoberfest eligible label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good first issue to get started with hacktoberfest Hacktoberfest eligible
Projects
None yet
Development

No branches or pull requests

2 participants