@microsoft/vscode-azext-github 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +7 -0
- package/out/src/GitHubContext.d.ts +9 -0
- package/out/src/GitHubContext.js +7 -0
- package/out/src/constants.d.ts +4 -0
- package/out/src/constants.js +13 -0
- package/out/src/createOctokitClient.d.ts +9 -0
- package/out/src/createOctokitClient.js +36 -0
- package/out/src/extensionVariables.d.ts +13 -0
- package/out/src/extensionVariables.js +43 -0
- package/out/src/index.d.ts +15 -0
- package/out/src/index.js +39 -0
- package/out/src/tree/ActionItem.d.ts +19 -0
- package/out/src/tree/ActionItem.js +81 -0
- package/out/src/tree/ActionsItemBase.d.ts +59 -0
- package/out/src/tree/ActionsItemBase.js +114 -0
- package/out/src/tree/JobItem.d.ts +16 -0
- package/out/src/tree/JobItem.js +51 -0
- package/out/src/tree/StepItem.d.ts +15 -0
- package/out/src/tree/StepItem.js +33 -0
- package/out/src/utils/actionUtils.d.ts +35 -0
- package/out/src/utils/actionUtils.js +128 -0
- package/out/src/utils/getGitHubAccessToken.d.ts +1 -0
- package/out/src/utils/getGitHubAccessToken.js +41 -0
- package/out/src/utils/gitHubUrlParse.d.ts +23 -0
- package/out/src/utils/gitHubUrlParse.js +23 -0
- package/out/src/wizard/GitHubBranchListStep.d.ts +13 -0
- package/out/src/wizard/GitHubBranchListStep.js +71 -0
- package/out/src/wizard/GitHubOrgListStep.d.ts +11 -0
- package/out/src/wizard/GitHubOrgListStep.js +52 -0
- package/out/src/wizard/GitHubRepositoryListStep.d.ts +13 -0
- package/out/src/wizard/GitHubRepositoryListStep.js +77 -0
- package/out/src/wrappers/getActions.d.ts +9 -0
- package/out/src/wrappers/getActions.js +28 -0
- package/out/src/wrappers/getAuthenticatedUser.d.ts +7 -0
- package/out/src/wrappers/getAuthenticatedUser.js +28 -0
- package/out/src/wrappers/getBranches.d.ts +11 -0
- package/out/src/wrappers/getBranches.js +28 -0
- package/out/src/wrappers/getJobs.d.ts +10 -0
- package/out/src/wrappers/getJobs.js +28 -0
- package/out/src/wrappers/getOrgs.d.ts +7 -0
- package/out/src/wrappers/getOrgs.js +28 -0
- package/out/src/wrappers/getRepositories.d.ts +16 -0
- package/out/src/wrappers/getRepositories.js +38 -0
- package/package.json +53 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getJobs = void 0;
|
|
17
|
+
const createOctokitClient_1 = require("../createOctokitClient");
|
|
18
|
+
/**
|
|
19
|
+
* A wrapper for Octokit's: `client.actions.listJobsForWorkflowRun`
|
|
20
|
+
*/
|
|
21
|
+
function getJobs(context, params) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const client = yield (0, createOctokitClient_1.createOctokitClient)(context);
|
|
24
|
+
return (yield client.actions.listJobsForWorkflowRun(params)).data;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.getJobs = getJobs;
|
|
28
|
+
//# sourceMappingURL=getJobs.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RestEndpointMethodTypes } from "@octokit/rest";
|
|
2
|
+
import type { GitHubContext } from "../GitHubContext";
|
|
3
|
+
export type Orgs = RestEndpointMethodTypes["orgs"]["listForAuthenticatedUser"]["response"]["data"];
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper for Octokit's: `client.orgs.listForAuthenticatedUser`
|
|
6
|
+
*/
|
|
7
|
+
export declare function getOrgs(context: GitHubContext): Promise<Orgs>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getOrgs = void 0;
|
|
17
|
+
const createOctokitClient_1 = require("../createOctokitClient");
|
|
18
|
+
/**
|
|
19
|
+
* A wrapper for Octokit's: `client.orgs.listForAuthenticatedUser`
|
|
20
|
+
*/
|
|
21
|
+
function getOrgs(context) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const client = yield (0, createOctokitClient_1.createOctokitClient)(context);
|
|
24
|
+
return (yield client.orgs.listForAuthenticatedUser()).data;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.getOrgs = getOrgs;
|
|
28
|
+
//# sourceMappingURL=getOrgs.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RestEndpointMethodTypes } from "@octokit/rest";
|
|
2
|
+
import type { GitHubContext } from "../GitHubContext";
|
|
3
|
+
export type UserRepos = RestEndpointMethodTypes["repos"]["listForAuthenticatedUser"]["response"]["data"];
|
|
4
|
+
export type GetUserReposReqParams = RestEndpointMethodTypes["repos"]["listForAuthenticatedUser"]["parameters"];
|
|
5
|
+
/**
|
|
6
|
+
* A wrapper for Octokit's: `client.repos.listForAuthenticatedUser`
|
|
7
|
+
*/
|
|
8
|
+
export declare function getRepositoriesByUser(context: GitHubContext, reqParams?: GetUserReposReqParams): Promise<UserRepos>;
|
|
9
|
+
export type OrgRepos = RestEndpointMethodTypes["repos"]["listForOrg"]["response"]["data"];
|
|
10
|
+
export type GetOrgReposReqParams = RestEndpointMethodTypes["repos"]["listForOrg"]["parameters"] & {
|
|
11
|
+
org: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A wrapper for Octokit's: `client.repos.listForOrg`
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRepositoriesByOrg(context: GitHubContext, reqParams: GetOrgReposReqParams): Promise<OrgRepos>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getRepositoriesByOrg = exports.getRepositoriesByUser = void 0;
|
|
17
|
+
const createOctokitClient_1 = require("../createOctokitClient");
|
|
18
|
+
/**
|
|
19
|
+
* A wrapper for Octokit's: `client.repos.listForAuthenticatedUser`
|
|
20
|
+
*/
|
|
21
|
+
function getRepositoriesByUser(context, reqParams) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const client = yield (0, createOctokitClient_1.createOctokitClient)(context);
|
|
24
|
+
return (yield client.repos.listForAuthenticatedUser(reqParams)).data;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.getRepositoriesByUser = getRepositoriesByUser;
|
|
28
|
+
/**
|
|
29
|
+
* A wrapper for Octokit's: `client.repos.listForOrg`
|
|
30
|
+
*/
|
|
31
|
+
function getRepositoriesByOrg(context, reqParams) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const client = yield (0, createOctokitClient_1.createOctokitClient)(context);
|
|
34
|
+
return (yield client.repos.listForOrg(reqParams)).data;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.getRepositoriesByOrg = getRepositoriesByOrg;
|
|
38
|
+
//# sourceMappingURL=getRepositories.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@microsoft/vscode-azext-github",
|
|
3
|
+
"author": "Microsoft Corporation",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Common GitHub tools for VS Code",
|
|
6
|
+
"tags": [
|
|
7
|
+
"azure",
|
|
8
|
+
"vscode"
|
|
9
|
+
],
|
|
10
|
+
"keywords": [
|
|
11
|
+
"azure",
|
|
12
|
+
"vscode"
|
|
13
|
+
],
|
|
14
|
+
"main": "out/src/index.js",
|
|
15
|
+
"types": "out/src/index.d.ts",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/Microsoft/vscode-azuretools"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/Microsoft/vscode-azuretools/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/main/github/README.md",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p ./",
|
|
27
|
+
"compile": "tsc -watch -p ./",
|
|
28
|
+
"lint": "eslint --ext .ts .",
|
|
29
|
+
"lint-fix": "eslint --ext .ts . --fix",
|
|
30
|
+
"package": "npm pack",
|
|
31
|
+
"test": "node ./out/test/runTest.js"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@microsoft/eslint-config-azuretools": "^0.2.1",
|
|
35
|
+
"@types/glob": "^8.1.0",
|
|
36
|
+
"@types/mocha": "^7.0.2",
|
|
37
|
+
"@types/node": "^16.0.0",
|
|
38
|
+
"@types/vscode": "1.76.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
40
|
+
"@vscode/test-electron": "^2.1.5",
|
|
41
|
+
"eslint": "^8.34.0",
|
|
42
|
+
"eslint-plugin-import": "^2.22.1",
|
|
43
|
+
"glob": "^7.1.6",
|
|
44
|
+
"mocha": "^9.1.3",
|
|
45
|
+
"mocha-junit-reporter": "^2.0.2",
|
|
46
|
+
"mocha-multi-reporters": "^1.1.7",
|
|
47
|
+
"typescript": "^5.1.3"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@microsoft/vscode-azext-utils": "^2.0.0",
|
|
51
|
+
"@octokit/rest": "^18.5.2"
|
|
52
|
+
}
|
|
53
|
+
}
|