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

feat: drop support for Enterprise Server and Enterprise Cloud-specific APIs, and add support for 10 new APIs #474

Closed
wants to merge 6 commits into from

Conversation

timrogers
Copy link
Contributor

  • feat: add support for new "Delete an organization secret" (DELETE /organizations/{org}/codespaces/secrets/{secret_name}) Codespaces API
  • feat: add support for new "Remove selected repository from an organization secret" (DELETE /organizations/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}) Codespaces API
  • feat: add support for new "List organization secrets" (GET /organizations/{org}/codespaces/secrets) Codespaces API
  • feat: add support for new "Get an organization public key" (GET /organizations/{org}/codespaces/secrets/public-key) Codespaces API
  • feat: add support for new "Get an organization secret" (GET /organizations/{org}/codespaces/secrets/{secret_name} ) Codespaces API
  • feat: add support for new "List selected repositories for an organization secret" (GET /organizations/{org}/codespaces/secrets/{secret_name}/repositories) Codespaces API
  • feat: add support for new "Get a Dependabot alert" API (GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number})
  • feat: add support for new "List Dependabot alerts for a repository" API (GET /repos/{owner}/{repo}/dependabot/alerts)
  • feat: add support for new "Update a Dependabot alert" API (PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number})
  • feat: adds support for new "Create or update an organization secret" (PUT /organizations/{org}/codespaces/secrets/{secret_name} ) Codespaces API
  • feat: add support for new "List selected repositories for an organization secret" (GET /organizations/{org}/codespaces/secrets/{secret_name}/repositories) Codespaces API
  • feat: add support for new "Add selected repository to an organization secret" (PUT /organizations/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}) Codespaces API

BREAKING CHANGE: This drops support for a number of APIs which are only available in GitHub Enterprise Server (GHES) and GitHub Enterprise Cloud (GHEC). If you want to use these APIs and/or see TypeScript errors after upgrading to this version, you may need to start using the @octokit/plugin-enterprise-cloud and/or @octokit/plugin-enterprise-server packages.

APIs, and add support for 10 new APIs

* feat: add support for new "Delete an organization secret"  (`DELETE
/organizations/{org}/codespaces/secrets/{secret_name}`) Codespaces API
* feat: add support for new "Remove selected repository from an
organization secret" (`DELETE
/organizations/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}`)
Codespaces API
* feat: add support for new "List organization secrets" (`GET
/organizations/{org}/codespaces/secrets`) Codespaces API
* feat: add support for new "Get an organization public key" (`GET
/organizations/{org}/codespaces/secrets/public-key`) Codespaces API
* feat: add support for new "Get an organization secret" (`GET
/organizations/{org}/codespaces/secrets/{secret_name}` ) Codespaces API
* feat: add support for new "List selected repositories for an
organization secret" (`GET
/organizations/{org}/codespaces/secrets/{secret_name}/repositories`)
Codespaces API
* feat: add support for new "Get a Dependabot alert" API (`GET
/repos/{owner}/{repo}/dependabot/alerts/{alert_number}`)
* feat: add support for new "List Dependabot alerts for a repository" API
(`GET /repos/{owner}/{repo}/dependabot/alerts`)
* feat: add support for new "Update a Dependabot alert" API (`PATCH
/repos/{owner}/{repo}/dependabot/alerts/{alert_number}`)
* feat: adds support for new "Create or update an organization secret"
(`PUT /organizations/{org}/codespaces/secrets/{secret_name}` ) Codespaces
API
* feat: add support for new "List selected repositories for an
organization secret" (`GET
/organizations/{org}/codespaces/secrets/{secret_name}/repositories`)
Codespaces API
* feat: add support for new "Add selected repository to an organization
secret" (`PUT
/organizations/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}`)
Codespaces API

BREAKING CHANGE: This drops support for a number of APIs which
are only available in GitHub Enterprise Server (GHES) and GitHub
Enterprise Cloud (GHEC). If you want to use these APIs and/or see
TypeScript errors after upgrading to this version, you may need
to start using the
[`@octokit/plugin-enterprise-cloud`]https://github.com/octokit/plugin-enterprise-cloud.js)
and/or
[`@octokit/plugin-enterprise-server`]*https://github.com/octokit/plugin-enterprise-server.js)
packages.
@timrogers timrogers added the Type: Feature New feature or request label Oct 3, 2022
@kfcampbell
Copy link
Member

I've validated that I can use @octokit/plugin-enterprise-cloud to perform operations for enterprise-cloud specific routes, e.g. getting an audit log for a test organization in a cloud enterprise:

import { Octokit } from "@octokit/core";
import { enterpriseCloud } from "@octokit/plugin-enterprise-cloud";

async function main() {
	console.log("enterprise cloud version: " + enterpriseCloud.VERSION);
	const MyOctokit = Octokit.plugin(enterpriseCloud);
	// note that GITHUB_TOKEN needs to be exported in the environment
	const octokit = new MyOctokit({ auth: process.env.GITHUB_TOKEN });
        const res = await octokit.orgs.getAuditLog({
		org: "octokit-js-sdk-testing",
         })
	console.log(JSON.stringify(res));
}

main();

@kfcampbell
Copy link
Member

I've also validated that I can use @octokit/plugin-enterprise-server to perform operations for GHES-specific routes, e.g. getting enterprise stats for a GHES instance:

import { Octokit } from "@octokit/core";
const {
	enterpriseServer36Admin,
} = require("@octokit/plugin-enterprise-server");

async function main() {
	const MyOctokit = Octokit.plugin(enterpriseServer36Admin);
	// note that GITHUB_TOKEN needs to be exported
	const octokit = new MyOctokit({
		auth: process.env.GITHUB_TOKEN,
		baseUrl: "https://REDACTED.ghe-test.com/api/v3",
	});

	// TODO: create a request using server-specific routes
	const res = await octokit.enterpriseAdmin.getAllStats({});
	console.log(JSON.stringify(res));

}

main();

With that, I've gained confidence that the GHES and GHEC plugins to Octokit.js are valid/operational.

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me given the above validation. The PR description already contains the "BREAKING CHANGE" string as specified in the maintaining.md.

@gr2m
Copy link
Contributor

gr2m commented Oct 13, 2022

sorry I totally missed this PR 🤦🏼 I just merged #463 which was the same change?

@gr2m
Copy link
Contributor

gr2m commented Oct 13, 2022

done via #463

@gr2m gr2m closed this Oct 13, 2022
@gr2m gr2m deleted the timrogers/remove-the-cloud branch October 13, 2022 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants