@salesforce/plugin-release-management 3.12.0 → 3.12.1
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type GithubCheckClosedResult = {
|
|
3
|
+
issueUrl: string;
|
|
4
|
+
status: string;
|
|
5
|
+
workItem: string;
|
|
6
|
+
};
|
|
7
|
+
export default class GithubCheckClosed extends SfCommand<GithubCheckClosedResult[]> {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
gus: import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
'github-token': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<GithubCheckClosedResult[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const core_2 = require("@octokit/core");
|
|
12
|
+
const plugin_throttling_1 = require("@octokit/plugin-throttling");
|
|
13
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-release-management', 'github.check.closed');
|
|
16
|
+
class GithubCheckClosed extends sf_plugins_core_1.SfCommand {
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(GithubCheckClosed);
|
|
19
|
+
const ThrottledOctokit = core_2.Octokit.plugin(plugin_throttling_1.throttling);
|
|
20
|
+
const octokit = new ThrottledOctokit({
|
|
21
|
+
auth: flags['github-token'],
|
|
22
|
+
throttle: {
|
|
23
|
+
onRateLimit: () => true,
|
|
24
|
+
onSecondaryRateLimit: () => true,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
// search open issues for W- in any comments
|
|
28
|
+
const issues = await octokit.request('GET /search/issues', {
|
|
29
|
+
q: 'is:open is:issue repo:forcedotcom/cli W- in:comments',
|
|
30
|
+
});
|
|
31
|
+
// get all comments for those issues
|
|
32
|
+
const commentsWithWI = (await Promise.all(issues.data.items.map((issue) => octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/comments', {
|
|
33
|
+
// eslint-disable-next-line camelcase
|
|
34
|
+
issue_number: issue.number,
|
|
35
|
+
owner: 'forcedotcom',
|
|
36
|
+
repo: 'cli',
|
|
37
|
+
}))))
|
|
38
|
+
// comment includes W-
|
|
39
|
+
.map((issueComments) => issueComments.data.find((comment) => comment.body.includes('W-')))
|
|
40
|
+
.filter(ts_types_1.isObject)
|
|
41
|
+
// extract url and WI number
|
|
42
|
+
.map((comment) => ({ issueUrl: comment.issue_url, workItem: comment.body.match(/W-[0-9]{8,9}/g) }))
|
|
43
|
+
.filter((item) => item.workItem?.length)
|
|
44
|
+
.map((item) => ({ issueUrl: item.issueUrl, workItem: item.workItem[0] }));
|
|
45
|
+
const wiToQuery = commentsWithWI.map((item) => item.workItem);
|
|
46
|
+
// query all those WI in GUS, and turn into a Map
|
|
47
|
+
const wiQueryResult = new Map((await flags.gus
|
|
48
|
+
.getConnection()
|
|
49
|
+
.sobject('ADM_Work__c')
|
|
50
|
+
.find({ Name: { $in: wiToQuery } })).map((item) => [item.Name, item.Status__c]));
|
|
51
|
+
// join GH and GUS results
|
|
52
|
+
const results = commentsWithWI
|
|
53
|
+
.map((item) => ({
|
|
54
|
+
...item,
|
|
55
|
+
status: wiQueryResult.get(item.workItem),
|
|
56
|
+
issueUrl: item.issueUrl.replace('api.', '').replace('repos/', ''),
|
|
57
|
+
}))
|
|
58
|
+
.filter((item) => item.status);
|
|
59
|
+
this.table(results, {
|
|
60
|
+
issueUrl: { header: 'github issue' },
|
|
61
|
+
workItem: { header: 'work item' },
|
|
62
|
+
status: { header: 'status' },
|
|
63
|
+
}, { sort: 'status' });
|
|
64
|
+
return results;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = GithubCheckClosed;
|
|
68
|
+
GithubCheckClosed.summary = messages.getMessage('summary');
|
|
69
|
+
GithubCheckClosed.description = messages.getMessage('description');
|
|
70
|
+
GithubCheckClosed.examples = messages.getMessages('examples');
|
|
71
|
+
GithubCheckClosed.flags = {
|
|
72
|
+
gus: sf_plugins_core_1.Flags.requiredOrg({
|
|
73
|
+
summary: messages.getMessage('flags.gus'),
|
|
74
|
+
}),
|
|
75
|
+
'github-token': sf_plugins_core_1.Flags.string({
|
|
76
|
+
summary: messages.getMessage('flags.github-token'),
|
|
77
|
+
env: 'GITHUB_TOKEN',
|
|
78
|
+
required: true,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=closed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closed.js","sourceRoot":"","sources":["../../../../src/commands/github/check/closed.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iEAA+D;AAC/D,2CAA4C;AAC5C,wCAAwC;AACxC,kEAAwD;AACxD,mDAAgD;AAEhD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,uCAAuC,EAAE,qBAAqB,CAAC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,QAAQ,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;YACpC,QAAQ,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;YACjC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC7B,EACD,EAAE,IAAI,EAAE,QAAQ,EAAE,CACnB,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;;AApFH,oCAqFC;AApFwB,yBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,6BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,0BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C,uBAAK,GAAG;IAC7B,GAAG,EAAE,uBAAK,CAAC,WAAW,CAAC;QACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC1C,CAAC;IACF,cAAc,EAAE,uBAAK,CAAC,MAAM,CAAC;QAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QAClD,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Show open Github issues with GUS WI
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Description of a command.
|
|
8
|
+
|
|
9
|
+
# flags.name.summary
|
|
10
|
+
|
|
11
|
+
Description of a flag.
|
|
12
|
+
|
|
13
|
+
# examples
|
|
14
|
+
|
|
15
|
+
- <%= config.bin %> <%= command.id %> -o me@gus.com
|
|
16
|
+
|
|
17
|
+
# flags.gus
|
|
18
|
+
|
|
19
|
+
Username/alias of your GUS org connection
|
|
20
|
+
|
|
21
|
+
# flags.github-token
|
|
22
|
+
|
|
23
|
+
Github token--store this in the environment as GITHUB_TOKEN
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.12.
|
|
2
|
+
"version": "3.12.1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"channel:promote": {
|
|
5
5
|
"id": "channel:promote",
|
|
@@ -989,6 +989,45 @@
|
|
|
989
989
|
},
|
|
990
990
|
"args": {}
|
|
991
991
|
},
|
|
992
|
+
"github:check:closed": {
|
|
993
|
+
"id": "github:check:closed",
|
|
994
|
+
"summary": "Show open Github issues with GUS WI",
|
|
995
|
+
"description": "Description of a command.",
|
|
996
|
+
"strict": true,
|
|
997
|
+
"pluginName": "@salesforce/plugin-release-management",
|
|
998
|
+
"pluginAlias": "@salesforce/plugin-release-management",
|
|
999
|
+
"pluginType": "core",
|
|
1000
|
+
"aliases": [],
|
|
1001
|
+
"examples": [
|
|
1002
|
+
"<%= config.bin %> <%= command.id %> -o me@gus.com"
|
|
1003
|
+
],
|
|
1004
|
+
"flags": {
|
|
1005
|
+
"json": {
|
|
1006
|
+
"name": "json",
|
|
1007
|
+
"type": "boolean",
|
|
1008
|
+
"description": "Format output as json.",
|
|
1009
|
+
"helpGroup": "GLOBAL",
|
|
1010
|
+
"allowNo": false
|
|
1011
|
+
},
|
|
1012
|
+
"gus": {
|
|
1013
|
+
"name": "gus",
|
|
1014
|
+
"type": "option",
|
|
1015
|
+
"char": "o",
|
|
1016
|
+
"summary": "Username/alias of your GUS org connection",
|
|
1017
|
+
"required": true,
|
|
1018
|
+
"multiple": false
|
|
1019
|
+
},
|
|
1020
|
+
"github-token": {
|
|
1021
|
+
"name": "github-token",
|
|
1022
|
+
"type": "option",
|
|
1023
|
+
"summary": "Github token--store this in the environment as GITHUB_TOKEN",
|
|
1024
|
+
"required": true,
|
|
1025
|
+
"multiple": false
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
"args": {},
|
|
1029
|
+
"hasDynamicHelp": true
|
|
1030
|
+
},
|
|
992
1031
|
"npm:dependencies:pin": {
|
|
993
1032
|
"id": "npm:dependencies:pin",
|
|
994
1033
|
"summary": "lock a list of dependencies to a target tag or default to 'latest', place these entries in 'pinnedDependencies' entry in the package.json",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-release-management",
|
|
3
3
|
"description": "A plugin for preparing and publishing npm packages",
|
|
4
|
-
"version": "3.12.
|
|
4
|
+
"version": "3.12.1",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"bin": {
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
"@oclif/core": "^2.0.9",
|
|
12
12
|
"@octokit/core": "^4.1.0",
|
|
13
13
|
"@octokit/plugin-paginate-rest": "^6.0.0",
|
|
14
|
+
"@octokit/plugin-throttling": "^5.0.1",
|
|
14
15
|
"@salesforce/core": "^3.32.12",
|
|
15
16
|
"@salesforce/kit": "^1.8.2",
|
|
16
|
-
"@salesforce/plugin-command-reference": "^2.
|
|
17
|
-
"@salesforce/plugin-trust": "^2.
|
|
17
|
+
"@salesforce/plugin-command-reference": "^2.3.1",
|
|
18
|
+
"@salesforce/plugin-trust": "^2.4.1",
|
|
18
19
|
"@salesforce/sf-plugins-core": "^2.0.1",
|
|
19
20
|
"@salesforce/ts-types": "^1.7.3",
|
|
20
21
|
"agent-base": "^6.0.2",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"@types/semver": "^7.3.9",
|
|
47
48
|
"@types/shelljs": "^0.8.8",
|
|
48
49
|
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
49
|
-
"@typescript-eslint/parser": "^5.
|
|
50
|
+
"@typescript-eslint/parser": "^5.52.0",
|
|
50
51
|
"aws-sdk-mock": "^5.8.0",
|
|
51
52
|
"chai": "^4.3.7",
|
|
52
53
|
"eslint": "^8.31.0",
|
|
@@ -128,17 +129,17 @@
|
|
|
128
129
|
"channel": {
|
|
129
130
|
"description": "interact with aws channels for clis"
|
|
130
131
|
},
|
|
131
|
-
"circleci": {
|
|
132
|
-
"description": "interact with circleci api",
|
|
133
|
-
"subtopics": {
|
|
134
|
-
"envvar": {
|
|
135
|
-
"description": "update and set environment variables in circleci"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
132
|
"dependabot": {
|
|
140
133
|
"description": "interact with dependabot PRs"
|
|
141
134
|
},
|
|
135
|
+
"github": {
|
|
136
|
+
"subtopics": {
|
|
137
|
+
"check": {
|
|
138
|
+
"description": "check github status"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"description": "interact with github issues"
|
|
142
|
+
},
|
|
142
143
|
"npm": {
|
|
143
144
|
"description": "release npm packages",
|
|
144
145
|
"subtopics": {
|
|
@@ -281,7 +282,7 @@
|
|
|
281
282
|
}
|
|
282
283
|
},
|
|
283
284
|
"sfdx": {
|
|
284
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-release-management/3.12.
|
|
285
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-release-management/3.12.
|
|
285
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-release-management/3.12.1.crt",
|
|
286
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-release-management/3.12.1.sig"
|
|
286
287
|
}
|
|
287
288
|
}
|