octokit / plugin-rest-endpoint-methods.js

Octokit plugin adding one method for all of api.github.com REST API endpoints
MIT License
116 stars 56 forks source link

GH Actions Self-hosted runner groups endpoints missing #448

Open Eddman opened 3 years ago

Eddman commented 3 years ago

What happened?

I'd like to call Self-hosted runner groups endpoints, but these are missing completely.

They are present in openapi-types, plugin-paginate-rest and types, but are not referenced in plugin-rest-endpoint-methods nor plugin-enterprise-server.

What did you expect to happen? Self-hosted runner groups endpoints should be available in plugin-rest-endpoint-methods and plugin-enterprise-server.

What the problem might be

gr2m commented 3 years ago

As far as I know, this endpoint is only accessible to GitHub Enterprise Cloud, can you confirm?

I remember it wasn't flagged correctly in the OpenAPI spec, so I had to add a workaround on my side https://github.com/gr2m/github-openapi-graphql-query/blob/405891d8cd001f2c126174e6f1bf5f9847213a54/lib/workarounds.js#L15

I didn't further investigate because the plan was to create a separate OpenAPI spec for GitHub Enterprise Cloud, but that still didn't happen. I think there was another reason why I had to add the workaround on my side, I wish I kept track of that instead of just writing "Due to complications" in the comment 🤷🏼

Eddman commented 3 years ago

That is not fully true. Runner groups are available for github.com (single group, but not manageable via API) as well as enterprise cloud as well as GitHub EE (self-hosted).

But you're right: I don't understand why you're "hiding" these 🙂 For me as Octokit user (even thou I'm GHEE user, not cloud) I may want to call these to manage my groups.... And now it is missing in plugin-enterprise-server as well.

gr2m commented 3 years ago

What is "GitHub EE"? Is that GitHub Enterprise Server?

We left out enterprise-only endpoints by default because the @octokit/plugin-rest-endpoint-methods plugin is so widely used, and in most cases folks don't need the Enterprise endpoints. We created https://github.com/octokit/plugin-enterprise-server.js and https://github.com/octokit/plugin-enterprise-cloud.js for that purpose. I think for your case you can use https://github.com/octokit/plugin-enterprise-cloud.js?

I've created the follow up issue on the OpenAPI spec repository, let's see what they API folks say.

We are aware that enterprise support is rather weak right now, it's one of the main motivations behind working on a revamped Octokit, you can follow updates at https://github.com/octokit/octokit-next.js if you are interested

Eddman commented 3 years ago

Yes, sorry, I meant GH Enterprise Server.

Will try to use plugin-enterprise-cloud.js for now...hopefully it will work for Enterprise Server as well. My only problem is that GH APIs usually differ in different versions of Enterprise Server. We're usually few steps behind (currently version 3.0, latest is 3.2, and Enterprise Cloud is even further) and there may already be breaking changes.

gr2m commented 3 years ago

Maybe that was the reason why the flag was not set, because it's supported by both GHEC & GHES, and setting githubCloudOnly to true might be confusing for consumers in GHES.

I think I would recommend to just use octokit.request for now, until we figure this out properly. Introducing methods from GHEC to a GHES environment might cause more problems than it solves.

axel3rd commented 2 years ago

+1, could be helpful to implement auto-scaling runners at enterprise level (available in GHES v3.3, partially in GHES v3.2) in Recommended autoscaling solutions => https://github.com/philips-labs/terraform-aws-github-runner/issues/1303