Skip to content

Commit cbb72f9

Browse files
committed
Updates for 2025-12-01
1 parent e51fa18 commit cbb72f9

40 files changed

+2724
-2929
lines changed

.config/.markdownlint-cli2.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"MD033": false
1010
},
1111
"ignores": [
12+
".github/prompts/**",
1213
"**/node_modules/**",
1314
"frontend/**",
1415
"microsoft/assets/**",

.github/copilot-instructions.md

Lines changed: 0 additions & 198 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@
505505
"DEBUG": "redis,restapi,startup,appinsights"
506506
}
507507
},
508-
509508
{
510509
"type": "node",
511510
"request": "launch",

api/client/newOrgRepo.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const router: Router = Router();
1010

1111
import { getProviders } from '../../lib/transitional.js';
1212
import { jsonError } from '../../middleware/jsonError.js';
13-
import { IndividualContext } from '../../business/user/index.js';
1413
import { Organization } from '../../business/organization.js';
1514
import {
1615
createRepositoryCore,
@@ -24,6 +23,7 @@ import {
2423
ReposAppRequest,
2524
VoidedExpressRoute,
2625
} from '../../interfaces/index.js';
26+
import type { IndividualContext } from '../../business/user/index.js';
2727

2828
// This file supports the client apps for creating repos.
2929

@@ -451,13 +451,12 @@ export async function createRepositoryFromClient(
451451
title: existingRepoId ? 'Repository unlocked' : 'Repository created',
452452
message,
453453
url: null,
454-
messages: null,
454+
messages: success.tasks,
455455
};
456+
delete output.tasks;
456457
if (success.github) {
457458
output.url = success.github.html_url;
458459
}
459-
output.messages = output['tasks'];
460-
delete output['tasks'];
461460
insights.trackEvent({
462461
name: 'ApiClientNewOrgRepoSuccessful',
463462
properties: {

api/createRepo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export interface ICreateRepositoryApiResult {
7272
repositoryId: number;
7373
organizationName: string;
7474
notified?: string[];
75-
tasks?: any[];
75+
tasks?: IRepositoryWorkflowOutput[];
7676
}
7777

7878
export type CreateRepositoryMicrosoftProperties = {
@@ -415,7 +415,7 @@ export async function createRepositoryCore(
415415
};
416416
// req.approvalRequest['ms.approvalId'] = requestId; // TODO: is this ever used?
417417
const repoWorkflow = new RepoWorkflowEngine(providers, organization, repository, approvalPackage);
418-
let output = [];
418+
let output: IRepositoryWorkflowOutput[] = [];
419419
try {
420420
output = await generateAndRunSecondaryTasks(repoWorkflow);
421421
} catch (rollbackNeededError) {

api/index.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,39 @@ import type { CreateRepositoryRequest } from './client/newOrgRepo.js';
2929

3030
const hardcodedApiVersions = ['2019-10-01', '2019-02-01', '2017-09-01', '2017-03-08', '2016-12-01'];
3131

32+
const MOST_RECENT_VERSION = hardcodedApiVersions[0];
33+
const CLIENT_ROUTE_PREFIX = '/client';
34+
35+
function skipApiVersionCheck(req: ReposAppRequest, prefixes: string[]) {
36+
for (const prefix of prefixes) {
37+
if (req.path.startsWith(prefix)) {
38+
return true;
39+
}
40+
}
41+
return false;
42+
}
43+
3244
function isClientRoute(req: ReposAppRequest) {
33-
const path = req.path.toLowerCase();
34-
return path.startsWith('/client');
45+
return req.path.startsWith(CLIENT_ROUTE_PREFIX);
3546
}
3647

3748
export default function routeApi(config: SiteConfiguration) {
3849
if (!config) {
3950
throw CreateError.InvalidParameters('No configuration provided to the API routes');
4051
}
52+
const companySpecificDeployment = getCompanySpecificDeployment();
53+
const skipApiVersionChecksForPrefixes =
54+
companySpecificDeployment?.routes?.api?.skipApiVersionChecksForPrefixes || [];
55+
const combinedSkipVersionPrefixes = [CLIENT_ROUTE_PREFIX, ...skipApiVersionChecksForPrefixes];
4156

4257
router.use('/webhook', apiWebhook);
4358

4459
router.use((req: ReposApiRequest, res: Response, next: NextFunction) => {
45-
if (isClientRoute(req)) {
60+
if (skipApiVersionCheck(req, combinedSkipVersionPrefixes)) {
4661
// The frontend client routes are hooked into Express after
4762
// the session middleware. The client route does not require
48-
// an API version.
63+
// an API version. Also, some APIs do not require a version.
64+
req.apiVersion = MOST_RECENT_VERSION;
4965
return next();
5066
}
5167
const apiVersion = (req.query['api-version'] || req.headers['api-version']) as string;

business/enterprise.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6-
import GitHubEnterpriseCopilot from './enterpriseCopilot.js';
76
import { GitHubTokenType, getGitHubTokenTypeFromValue } from '../lib/github/appTokens.js';
87
import { CreateError } from '../lib/transitional.js';
98
import { createPagedCacheOptions, getPageSize, symbolizeApiResponse } from './operations/core.js';
@@ -14,6 +13,7 @@ import type {
1413
IPagedCacheOptions,
1514
IProviders,
1615
} from '../interfaces/index.js';
16+
import GitHubEnterpriseBilling from './enterpriseBilling.js';
1717

1818
// TODO: paginate across enterprise fix + support iterators
1919

@@ -98,7 +98,7 @@ function isStringToken(token: string | GetAuthorizationHeader): token is string
9898
}
9999

100100
export default class GitHubEnterprise {
101-
private _copilot: GitHubEnterpriseCopilot;
101+
private _billing: GitHubEnterpriseBilling;
102102
private _graphqlNodeId: string;
103103

104104
constructor(
@@ -138,15 +138,21 @@ export default class GitHubEnterprise {
138138
}
139139

140140
get copilot() {
141-
if (!this._copilot) {
141+
throw CreateError.NotImplemented(
142+
'GitHub Copilot use APIs are not published to the open source project currently.'
143+
);
144+
}
145+
146+
get billing() {
147+
if (!this._billing) {
142148
if (!isStringToken(this.enterpriseToken)) {
143149
throw CreateError.InvalidParameters(
144-
'Copilot APIs currently require a string token. Please use a separate instance.'
150+
'Billing APIs currently require a string token. Please use a separate instance.'
145151
);
146152
}
147-
this._copilot = new GitHubEnterpriseCopilot(this.providers, this, this.enterpriseToken);
153+
this._billing = new GitHubEnterpriseBilling(this.providers, this, this.enterpriseToken);
148154
}
149-
return this._copilot;
155+
return this._billing;
150156
}
151157

152158
async getId(): Promise<string> {

0 commit comments

Comments
 (0)