mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fixes build folder compilation + enable linux .deb files (#23006)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.OctoKitIssue = exports.OctoKit = void 0;
|
||||
const core_1 = require("@actions/core");
|
||||
const github_1 = require("@actions/github");
|
||||
const child_process_1 = require("child_process");
|
||||
@@ -20,7 +21,6 @@ class OctoKit {
|
||||
}
|
||||
async *query(query) {
|
||||
const q = query.q + ` repo:${this.params.owner}/${this.params.repo}`;
|
||||
console.log(`Querying for ${q}:`);
|
||||
const options = this.octokit.search.issuesAndPullRequests.endpoint.merge({
|
||||
...query,
|
||||
q,
|
||||
@@ -41,19 +41,17 @@ class OctoKit {
|
||||
};
|
||||
for await (const pageResponse of this.octokit.paginate.iterator(options)) {
|
||||
await timeout();
|
||||
await utils_1.logRateLimit(this.token);
|
||||
await (0, utils_1.logRateLimit)(this.token);
|
||||
const page = pageResponse.data;
|
||||
console.log(`Page ${++pageNum}: ${page.map(({ number }) => number).join(' ')}`);
|
||||
yield page.map((issue) => new OctoKitIssue(this.token, this.params, this.octokitIssueToIssue(issue)));
|
||||
}
|
||||
}
|
||||
async createIssue(owner, repo, title, body) {
|
||||
core_1.debug(`Creating issue \`${title}\` on ${owner}/${repo}`);
|
||||
(0, core_1.debug)(`Creating issue \`${title}\` on ${owner}/${repo}`);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.create({ owner, repo, title, body });
|
||||
}
|
||||
octokitIssueToIssue(issue) {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
return {
|
||||
author: { name: issue.user.login, isGitHubApp: issue.user.type === 'Bot' },
|
||||
body: issue.body,
|
||||
@@ -64,8 +62,8 @@ class OctoKit {
|
||||
locked: issue.locked,
|
||||
numComments: issue.comments,
|
||||
reactions: issue.reactions,
|
||||
assignee: (_b = (_a = issue.assignee) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : (_d = (_c = issue.assignees) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.login,
|
||||
milestoneId: (_f = (_e = issue.milestone) === null || _e === void 0 ? void 0 : _e.number) !== null && _f !== void 0 ? _f : null,
|
||||
assignee: issue.assignee?.login ?? issue.assignees?.[0]?.login,
|
||||
milestoneId: issue.milestone?.number ?? null,
|
||||
createdAt: +new Date(issue.created_at),
|
||||
updatedAt: +new Date(issue.updated_at),
|
||||
closedAt: issue.closed_at ? +new Date(issue.closed_at) : undefined,
|
||||
@@ -73,10 +71,10 @@ class OctoKit {
|
||||
}
|
||||
async hasWriteAccess(user) {
|
||||
if (user.name in this.writeAccessCache) {
|
||||
core_1.debug('Got permissions from cache for ' + user);
|
||||
(0, core_1.debug)('Got permissions from cache for ' + user);
|
||||
return this.writeAccessCache[user.name];
|
||||
}
|
||||
core_1.debug('Fetching permissions for ' + user);
|
||||
(0, core_1.debug)('Fetching permissions for ' + user);
|
||||
const permissions = (await this.octokit.repos.getCollaboratorPermissionLevel({
|
||||
...this.params,
|
||||
username: user.name,
|
||||
@@ -96,14 +94,14 @@ class OctoKit {
|
||||
}
|
||||
}
|
||||
async createLabel(name, color, description) {
|
||||
core_1.debug('Creating label ' + name);
|
||||
(0, core_1.debug)('Creating label ' + name);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.createLabel({ ...this.params, color, description, name });
|
||||
else
|
||||
this.mockLabels.add(name);
|
||||
}
|
||||
async deleteLabel(name) {
|
||||
core_1.debug('Deleting label ' + name);
|
||||
(0, core_1.debug)('Deleting label ' + name);
|
||||
try {
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.deleteLabel({ ...this.params, name });
|
||||
@@ -116,7 +114,7 @@ class OctoKit {
|
||||
}
|
||||
}
|
||||
async readConfig(path) {
|
||||
core_1.debug('Reading config at ' + path);
|
||||
(0, core_1.debug)('Reading config at ' + path);
|
||||
const repoPath = `.github/${path}.json`;
|
||||
const data = (await this.octokit.repos.getContents({ ...this.params, path: repoPath })).data;
|
||||
if ('type' in data && data.type === 'file') {
|
||||
@@ -128,10 +126,10 @@ class OctoKit {
|
||||
throw Error('Found directory at config path when expecting file' + JSON.stringify(data));
|
||||
}
|
||||
async releaseContainsCommit(release, commit) {
|
||||
if (utils_1.getInput('commitReleasedDebuggingOverride')) {
|
||||
if ((0, utils_1.getInput)('commitReleasedDebuggingOverride')) {
|
||||
return true;
|
||||
}
|
||||
return new Promise((resolve, reject) => child_process_1.exec(`git -C ./repo merge-base --is-ancestor ${commit} ${release}`, (err) => !err || err.code === 1 ? resolve(!err) : reject(err)));
|
||||
return new Promise((resolve, reject) => (0, child_process_1.exec)(`git -C ./repo merge-base --is-ancestor ${commit} ${release}`, (err) => !err || err.code === 1 ? resolve(!err) : reject(err)));
|
||||
}
|
||||
}
|
||||
exports.OctoKit = OctoKit;
|
||||
@@ -142,7 +140,7 @@ class OctoKitIssue extends OctoKit {
|
||||
this.issueData = issueData;
|
||||
}
|
||||
async addAssignee(assignee) {
|
||||
core_1.debug('Adding assignee ' + assignee + ' to ' + this.issueData.number);
|
||||
(0, core_1.debug)('Adding assignee ' + assignee + ' to ' + this.issueData.number);
|
||||
if (!this.options.readonly) {
|
||||
await this.octokit.issues.addAssignees({
|
||||
...this.params,
|
||||
@@ -152,7 +150,7 @@ class OctoKitIssue extends OctoKit {
|
||||
}
|
||||
}
|
||||
async closeIssue() {
|
||||
core_1.debug('Closing issue ' + this.issueData.number);
|
||||
(0, core_1.debug)('Closing issue ' + this.issueData.number);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.update({
|
||||
...this.params,
|
||||
@@ -161,16 +159,15 @@ class OctoKitIssue extends OctoKit {
|
||||
});
|
||||
}
|
||||
async lockIssue() {
|
||||
core_1.debug('Locking issue ' + this.issueData.number);
|
||||
(0, core_1.debug)('Locking issue ' + this.issueData.number);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.lock({ ...this.params, issue_number: this.issueData.number });
|
||||
}
|
||||
async getIssue() {
|
||||
if (isIssue(this.issueData)) {
|
||||
core_1.debug('Got issue data from query result ' + this.issueData.number);
|
||||
(0, core_1.debug)('Got issue data from query result ' + this.issueData.number);
|
||||
return this.issueData;
|
||||
}
|
||||
console.log('Fetching issue ' + this.issueData.number);
|
||||
const issue = (await this.octokit.issues.get({
|
||||
...this.params,
|
||||
issue_number: this.issueData.number,
|
||||
@@ -179,7 +176,7 @@ class OctoKitIssue extends OctoKit {
|
||||
return (this.issueData = this.octokitIssueToIssue(issue));
|
||||
}
|
||||
async postComment(body) {
|
||||
core_1.debug(`Posting comment ${body} on ${this.issueData.number}`);
|
||||
(0, core_1.debug)(`Posting comment ${body} on ${this.issueData.number}`);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.createComment({
|
||||
...this.params,
|
||||
@@ -188,7 +185,7 @@ class OctoKitIssue extends OctoKit {
|
||||
});
|
||||
}
|
||||
async deleteComment(id) {
|
||||
core_1.debug(`Deleting comment ${id} on ${this.issueData.number}`);
|
||||
(0, core_1.debug)(`Deleting comment ${id} on ${this.issueData.number}`);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.deleteComment({
|
||||
owner: this.params.owner,
|
||||
@@ -197,7 +194,7 @@ class OctoKitIssue extends OctoKit {
|
||||
});
|
||||
}
|
||||
async setMilestone(milestoneId) {
|
||||
core_1.debug(`Setting milestone for ${this.issueData.number} to ${milestoneId}`);
|
||||
(0, core_1.debug)(`Setting milestone for ${this.issueData.number} to ${milestoneId}`);
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.update({
|
||||
...this.params,
|
||||
@@ -206,7 +203,7 @@ class OctoKitIssue extends OctoKit {
|
||||
});
|
||||
}
|
||||
async *getComments(last) {
|
||||
core_1.debug('Fetching comments for ' + this.issueData.number);
|
||||
(0, core_1.debug)('Fetching comments for ' + this.issueData.number);
|
||||
const response = this.octokit.paginate.iterator(this.octokit.issues.listComments.endpoint.merge({
|
||||
...this.params,
|
||||
issue_number: this.issueData.number,
|
||||
@@ -223,7 +220,7 @@ class OctoKitIssue extends OctoKit {
|
||||
}
|
||||
}
|
||||
async addLabel(name) {
|
||||
core_1.debug(`Adding label ${name} to ${this.issueData.number}`);
|
||||
(0, core_1.debug)(`Adding label ${name} to ${this.issueData.number}`);
|
||||
if (!(await this.repoHasLabel(name))) {
|
||||
throw Error(`Action could not execute becuase label ${name} is not defined.`);
|
||||
}
|
||||
@@ -235,7 +232,7 @@ class OctoKitIssue extends OctoKit {
|
||||
});
|
||||
}
|
||||
async removeLabel(name) {
|
||||
core_1.debug(`Removing label ${name} from ${this.issueData.number}`);
|
||||
(0, core_1.debug)(`Removing label ${name} from ${this.issueData.number}`);
|
||||
try {
|
||||
if (!this.options.readonly)
|
||||
await this.octokit.issues.removeLabel({
|
||||
@@ -246,14 +243,12 @@ class OctoKitIssue extends OctoKit {
|
||||
}
|
||||
catch (err) {
|
||||
if (err.status === 404) {
|
||||
console.log(`Label ${name} not found on issue`);
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
async getClosingInfo() {
|
||||
var _a;
|
||||
if ((await this.getIssue()).open) {
|
||||
return;
|
||||
}
|
||||
@@ -267,13 +262,12 @@ class OctoKitIssue extends OctoKit {
|
||||
for (const timelineEvent of timelineEvents) {
|
||||
if (timelineEvent.event === 'closed') {
|
||||
closingCommit = {
|
||||
hash: (_a = timelineEvent.commit_id) !== null && _a !== void 0 ? _a : undefined,
|
||||
hash: timelineEvent.commit_id ?? undefined,
|
||||
timestamp: +new Date(timelineEvent.created_at),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`Got ${closingCommit} as closing commit of ${this.issueData.number}`);
|
||||
return closingCommit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ export class OctoKit implements GitHub {
|
||||
|
||||
async *query(query: Query): AsyncIterableIterator<GitHubIssue[]> {
|
||||
const q = query.q + ` repo:${this.params.owner}/${this.params.repo}`
|
||||
console.log(`Querying for ${q}:`)
|
||||
|
||||
const options = this.octokit.search.issuesAndPullRequests.endpoint.merge({
|
||||
...query,
|
||||
@@ -50,7 +49,6 @@ export class OctoKit implements GitHub {
|
||||
await timeout()
|
||||
await logRateLimit(this.token)
|
||||
const page: Array<Octokit.SearchIssuesAndPullRequestsResponseItemsItem> = pageResponse.data
|
||||
console.log(`Page ${++pageNum}: ${page.map(({ number }) => number).join(' ')}`)
|
||||
yield page.map(
|
||||
(issue) => new OctoKitIssue(this.token, this.params, this.octokitIssueToIssue(issue)),
|
||||
)
|
||||
@@ -199,7 +197,6 @@ export class OctoKitIssue extends OctoKit implements GitHubIssue {
|
||||
return this.issueData
|
||||
}
|
||||
|
||||
console.log('Fetching issue ' + this.issueData.number)
|
||||
const issue = (
|
||||
await this.octokit.issues.get({
|
||||
...this.params,
|
||||
@@ -286,7 +283,6 @@ export class OctoKitIssue extends OctoKit implements GitHubIssue {
|
||||
})
|
||||
} catch (err) {
|
||||
if (err.status === 404) {
|
||||
console.log(`Label ${name} not found on issue`)
|
||||
return
|
||||
}
|
||||
throw err
|
||||
@@ -314,7 +310,6 @@ export class OctoKitIssue extends OctoKit implements GitHubIssue {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`Got ${closingCommit} as closing commit of ${this.issueData.number}`)
|
||||
return closingCommit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TestbedIssue = exports.Testbed = void 0;
|
||||
class Testbed {
|
||||
constructor(config) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
this.config = {
|
||||
globalLabels: (_a = config === null || config === void 0 ? void 0 : config.globalLabels) !== null && _a !== void 0 ? _a : [],
|
||||
configs: (_b = config === null || config === void 0 ? void 0 : config.configs) !== null && _b !== void 0 ? _b : {},
|
||||
writers: (_c = config === null || config === void 0 ? void 0 : config.writers) !== null && _c !== void 0 ? _c : [],
|
||||
releasedCommits: (_d = config === null || config === void 0 ? void 0 : config.releasedCommits) !== null && _d !== void 0 ? _d : [],
|
||||
queryRunner: (_e = config === null || config === void 0 ? void 0 : config.queryRunner) !== null && _e !== void 0 ? _e : async function* () {
|
||||
yield [];
|
||||
},
|
||||
globalLabels: config?.globalLabels ?? [],
|
||||
configs: config?.configs ?? {},
|
||||
writers: config?.writers ?? [],
|
||||
releasedCommits: config?.releasedCommits ?? [],
|
||||
queryRunner: config?.queryRunner ??
|
||||
async function* () {
|
||||
yield [];
|
||||
},
|
||||
};
|
||||
}
|
||||
async *query(query) {
|
||||
@@ -47,16 +48,15 @@ class Testbed {
|
||||
exports.Testbed = Testbed;
|
||||
class TestbedIssue extends Testbed {
|
||||
constructor(globalConfig, issueConfig) {
|
||||
var _a, _b, _c;
|
||||
super(globalConfig);
|
||||
issueConfig = issueConfig !== null && issueConfig !== void 0 ? issueConfig : {};
|
||||
issueConfig.comments = (_a = issueConfig === null || issueConfig === void 0 ? void 0 : issueConfig.comments) !== null && _a !== void 0 ? _a : [];
|
||||
issueConfig.labels = (_b = issueConfig === null || issueConfig === void 0 ? void 0 : issueConfig.labels) !== null && _b !== void 0 ? _b : [];
|
||||
issueConfig = issueConfig ?? {};
|
||||
issueConfig.comments = issueConfig?.comments ?? [];
|
||||
issueConfig.labels = issueConfig?.labels ?? [];
|
||||
issueConfig.issue = {
|
||||
author: { name: 'JacksonKearl' },
|
||||
body: 'issue body',
|
||||
locked: false,
|
||||
numComments: ((_c = issueConfig === null || issueConfig === void 0 ? void 0 : issueConfig.comments) === null || _c === void 0 ? void 0 : _c.length) || 0,
|
||||
numComments: issueConfig?.comments?.length || 0,
|
||||
number: 1,
|
||||
open: true,
|
||||
title: 'issue title',
|
||||
@@ -90,7 +90,7 @@ class TestbedIssue extends Testbed {
|
||||
}
|
||||
async postComment(body, author) {
|
||||
this.issueConfig.comments.push({
|
||||
author: { name: author !== null && author !== void 0 ? author : 'bot' },
|
||||
author: { name: author ?? 'bot' },
|
||||
body,
|
||||
id: Math.random(),
|
||||
timestamp: +new Date(),
|
||||
|
||||
@@ -8,15 +8,15 @@ const core = require("@actions/core");
|
||||
const github_1 = require("@actions/github");
|
||||
const octokit_1 = require("../api/octokit");
|
||||
const utils_1 = require("../utils/utils");
|
||||
const token = utils_1.getRequiredInput('token');
|
||||
const label = utils_1.getRequiredInput('label');
|
||||
const token = (0, utils_1.getRequiredInput)('token');
|
||||
const label = (0, utils_1.getRequiredInput)('label');
|
||||
async function main() {
|
||||
const pr = new octokit_1.OctoKitIssue(token, github_1.context.repo, { number: github_1.context.issue.number });
|
||||
pr.addLabel(label);
|
||||
}
|
||||
main()
|
||||
.then(() => utils_1.logRateLimit(token))
|
||||
.then(() => (0, utils_1.logRateLimit)(token))
|
||||
.catch(async (error) => {
|
||||
core.setFailed(error.message);
|
||||
await utils_1.logErrorToIssue(error.message, true, token);
|
||||
await (0, utils_1.logErrorToIssue)(error.message, true, token);
|
||||
});
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
{
|
||||
"name": "github-actions",
|
||||
"version": "1.0.0",
|
||||
"description": "GitHub Actions",
|
||||
"scripts": {
|
||||
"test": "mocha -r ts-node/register **/*.test.ts",
|
||||
"build": "tsc -p ./tsconfig.json",
|
||||
"lint": "eslint -c .eslintrc --fix --ext .ts .",
|
||||
"watch-typecheck": "tsc --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/microsoft/azuredatastudio.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^2.1.1",
|
||||
"axios": "^0.21.4",
|
||||
"name": "github-actions",
|
||||
"version": "1.0.0",
|
||||
"description": "GitHub Actions",
|
||||
"scripts": {
|
||||
"test": "mocha -r ts-node/register **/*.test.ts",
|
||||
"build": "tsc -p ./tsconfig.json",
|
||||
"compile": "tsc -p ./tsconfig.json",
|
||||
"lint": "eslint -c .eslintrc --fix --ext .ts .",
|
||||
"watch-typecheck": "tsc --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/microsoft/azuredatastudio.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^2.1.1",
|
||||
"axios": "^0.21.4",
|
||||
"ts-node": "^8.6.2",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logErrorToIssue = exports.logRateLimit = exports.daysAgoToHumanReadbleDate = exports.daysAgoToTimestamp = exports.loadLatestRelease = exports.normalizeIssue = exports.getRequiredInput = exports.getInput = void 0;
|
||||
const core = require("@actions/core");
|
||||
const github_1 = require("@actions/github");
|
||||
const axios_1 = require("axios");
|
||||
const octokit_1 = require("../api/octokit");
|
||||
exports.getInput = (name) => core.getInput(name) || undefined;
|
||||
exports.getRequiredInput = (name) => core.getInput(name, { required: true });
|
||||
exports.normalizeIssue = (issue) => {
|
||||
const getInput = (name) => core.getInput(name) || undefined;
|
||||
exports.getInput = getInput;
|
||||
const getRequiredInput = (name) => core.getInput(name, { required: true });
|
||||
exports.getRequiredInput = getRequiredInput;
|
||||
const normalizeIssue = (issue) => {
|
||||
const { body, title } = issue;
|
||||
const isBug = body.includes('bug_report_template') || /Issue Type:.*Bug.*/.test(body);
|
||||
const isFeatureRequest = body.includes('feature_request_template') || /Issue Type:.*Feature Request.*/.test(body);
|
||||
@@ -33,23 +36,25 @@ exports.normalizeIssue = (issue) => {
|
||||
issueType: isBug ? 'bug' : isFeatureRequest ? 'feature_request' : 'unknown',
|
||||
};
|
||||
};
|
||||
exports.loadLatestRelease = async (quality) => (await axios_1.default.get(`https://vscode-update.azurewebsites.net/api/update/darwin/${quality}/latest`)).data;
|
||||
exports.daysAgoToTimestamp = (days) => +new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
||||
exports.daysAgoToHumanReadbleDate = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().replace(/\.\d{3}\w$/, '');
|
||||
exports.logRateLimit = async (token) => {
|
||||
exports.normalizeIssue = normalizeIssue;
|
||||
const loadLatestRelease = async (quality) => (await axios_1.default.get(`https://vscode-update.azurewebsites.net/api/update/darwin/${quality}/latest`)).data;
|
||||
exports.loadLatestRelease = loadLatestRelease;
|
||||
const daysAgoToTimestamp = (days) => +new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
||||
exports.daysAgoToTimestamp = daysAgoToTimestamp;
|
||||
const daysAgoToHumanReadbleDate = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().replace(/\.\d{3}\w$/, '');
|
||||
exports.daysAgoToHumanReadbleDate = daysAgoToHumanReadbleDate;
|
||||
const logRateLimit = async (token) => {
|
||||
const usageData = (await new github_1.GitHub(token).rateLimit.get()).data.resources;
|
||||
['core', 'graphql', 'search'].forEach(async (category) => {
|
||||
const usage = 1 - usageData[category].remaining / usageData[category].limit;
|
||||
const message = `Usage at ${usage} for ${category}`;
|
||||
if (usage > 0) {
|
||||
console.log(message);
|
||||
}
|
||||
if (usage > 0.5) {
|
||||
await exports.logErrorToIssue(message, false, token);
|
||||
await (0, exports.logErrorToIssue)(message, false, token);
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.logErrorToIssue = async (message, ping, token) => {
|
||||
exports.logRateLimit = logRateLimit;
|
||||
const logErrorToIssue = async (message, ping, token) => {
|
||||
// Attempt to wait out abuse detection timeout if present
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
const dest = github_1.context.repo.repo === 'vscode-internalbacklog'
|
||||
@@ -70,3 +75,4 @@ ${JSON.stringify(github_1.context, null, 2).replace(/<!--/gu, '<@--').replace(/-
|
||||
-->
|
||||
`);
|
||||
};
|
||||
exports.logErrorToIssue = logErrorToIssue;
|
||||
|
||||
@@ -58,13 +58,10 @@ export const daysAgoToHumanReadbleDate = (days: number) =>
|
||||
new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().replace(/\.\d{3}\w$/, '')
|
||||
|
||||
export const logRateLimit = async (token: string) => {
|
||||
const usageData = (await new GitHub(token).rateLimit.get()).data.resources
|
||||
;(['core', 'graphql', 'search'] as const).forEach(async (category) => {
|
||||
const usageData = (await new GitHub(token).rateLimit.get()).data.resources;
|
||||
(['core', 'graphql', 'search'] as const).forEach(async (category) => {
|
||||
const usage = 1 - usageData[category].remaining / usageData[category].limit
|
||||
const message = `Usage at ${usage} for ${category}`
|
||||
if (usage > 0) {
|
||||
console.log(message)
|
||||
}
|
||||
if (usage > 0.5) {
|
||||
await logErrorToIssue(message, false, token)
|
||||
}
|
||||
|
||||
@@ -285,6 +285,8 @@ node-fetch@^2.3.0:
|
||||
version "2.6.7"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
||||
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
||||
dependencies:
|
||||
whatwg-url "^5.0.0"
|
||||
|
||||
npm-run-path@^2.0.0:
|
||||
version "2.0.2"
|
||||
@@ -371,6 +373,11 @@ strip-eof@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
|
||||
integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
|
||||
|
||||
tr46@~0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
|
||||
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
|
||||
|
||||
ts-node@^8.6.2:
|
||||
version "8.9.0"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.0.tgz#d7bf7272dcbecd3a2aa18bd0b96c7d2f270c15d4"
|
||||
@@ -388,9 +395,9 @@ tunnel@0.0.6, tunnel@^0.0.6:
|
||||
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
|
||||
|
||||
typescript@^3.8.3:
|
||||
version "3.8.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
|
||||
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
|
||||
version "3.9.10"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8"
|
||||
integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==
|
||||
|
||||
universal-user-agent@^4.0.0:
|
||||
version "4.0.1"
|
||||
@@ -411,6 +418,19 @@ uuid@^8.3.2:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
webidl-conversions@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
||||
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
|
||||
|
||||
whatwg-url@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
|
||||
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
|
||||
dependencies:
|
||||
tr46 "~0.0.3"
|
||||
webidl-conversions "^3.0.0"
|
||||
|
||||
which@^1.2.9:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
|
||||
Reference in New Issue
Block a user