Update classifier inputs and query parameters (#274)
This commit is contained in:
Родитель
8eedcd3589
Коммит
7815c4d9cf
|
@ -1,9 +1,21 @@
|
|||
name: "Classifier: Apply Labels"
|
||||
description: Applies labels generated from the python script back to their respective issues
|
||||
inputs:
|
||||
token:
|
||||
description: GitHub token with issue, comment, and label read/write permissions
|
||||
default: ${{ github.token }}
|
||||
app_id:
|
||||
description: GitHub App ID
|
||||
required: true
|
||||
app_installation_id:
|
||||
description: GitHub App Installation ID
|
||||
required: true
|
||||
app_private_key:
|
||||
description: GitHub App Private Key
|
||||
required: true
|
||||
owner:
|
||||
description: Repository owner
|
||||
required: true
|
||||
repo:
|
||||
description: Repository name
|
||||
required: true
|
||||
configPath:
|
||||
description: The PATH of a .github/PATH.json in the repo that describes what should be done per feature area
|
||||
required: true
|
||||
|
|
|
@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.Availability = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const github_1 = require("@actions/github");
|
||||
const octokit_1 = require("../../../api/octokit");
|
||||
const utils_1 = require("../../../common/utils");
|
||||
const Action_1 = require("../../../common/Action");
|
||||
const vscodeTools_1 = require("../../../api/vscodeTools");
|
||||
const token = (0, utils_1.getRequiredInput)('token');
|
||||
const Action_1 = require("../../../common/Action");
|
||||
const utils_1 = require("../../../common/utils");
|
||||
const allowLabels = ((0, utils_1.getInput)('allowLabels') || '').split('|');
|
||||
const debug = !!(0, utils_1.getInput)('__debug');
|
||||
const repo = (0, utils_1.getRequiredInput)('repo');
|
||||
const owner = (0, utils_1.getRequiredInput)('owner');
|
||||
// Do not modify.
|
||||
// Copied from https://github.com/microsoft/vscode-tools/blob/91715fe00caab042b4aab5ed41d0402b0ae2393b/src/common/endgame.ts#L11-L16
|
||||
var Availability;
|
||||
|
@ -32,9 +32,10 @@ class ApplyLabels extends Action_1.Action {
|
|||
async onTriggered(github) {
|
||||
var _a;
|
||||
const config = await github.readConfig((0, utils_1.getRequiredInput)('configPath'));
|
||||
const token = await (0, Action_1.getAuthenticationToken)();
|
||||
const labelings = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../issue_labels.json'), { encoding: 'utf8' }));
|
||||
for (const labeling of labelings) {
|
||||
const issue = new octokit_1.OctoKitIssue(token, github_1.context.repo, { number: labeling.number });
|
||||
const issue = new octokit_1.OctoKitIssue(token, { owner, repo }, { number: labeling.number });
|
||||
const potentialAssignees = [];
|
||||
const addAssignee = async (assignee) => {
|
||||
var _a;
|
||||
|
|
|
@ -5,16 +5,15 @@
|
|||
|
||||
import { readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { context } from '@actions/github';
|
||||
import { OctoKit, OctoKitIssue } from '../../../api/octokit';
|
||||
import { getRequiredInput, getInput, safeLog, daysAgoToHumanReadbleDate } from '../../../common/utils';
|
||||
import { Action } from '../../../common/Action';
|
||||
import { VSCodeToolsAPIManager } from '../../../api/vscodeTools';
|
||||
|
||||
const token = getRequiredInput('token');
|
||||
import { Action, getAuthenticationToken } from '../../../common/Action';
|
||||
import { daysAgoToHumanReadbleDate, getInput, getRequiredInput, safeLog } from '../../../common/utils';
|
||||
|
||||
const allowLabels = (getInput('allowLabels') || '').split('|');
|
||||
const debug = !!getInput('__debug');
|
||||
const repo = getRequiredInput('repo');
|
||||
const owner = getRequiredInput('owner');
|
||||
|
||||
type ClassifierConfig = {
|
||||
vacation?: string[];
|
||||
|
@ -43,12 +42,13 @@ class ApplyLabels extends Action {
|
|||
|
||||
async onTriggered(github: OctoKit) {
|
||||
const config: ClassifierConfig = await github.readConfig(getRequiredInput('configPath'));
|
||||
const token = await getAuthenticationToken();
|
||||
const labelings: LabelingsFile = JSON.parse(
|
||||
readFileSync(join(__dirname, '../issue_labels.json'), { encoding: 'utf8' }),
|
||||
);
|
||||
|
||||
for (const labeling of labelings) {
|
||||
const issue = new OctoKitIssue(token, context.repo, { number: labeling.number });
|
||||
const issue = new OctoKitIssue(token, { owner, repo }, { number: labeling.number });
|
||||
|
||||
const potentialAssignees: string[] = [];
|
||||
const addAssignee = async (assignee: string) => {
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
name: "Classifier: Fetch Sources"
|
||||
description: Collect the issues/models/etc which are needed for later stages
|
||||
inputs:
|
||||
token:
|
||||
description: GitHub token with issue, comment, and label read/write permissions
|
||||
default: ${{ github.token }}
|
||||
app_id:
|
||||
description: GitHub App ID
|
||||
required: true
|
||||
app_installation_id:
|
||||
description: GitHub App Installation ID
|
||||
required: true
|
||||
app_private_key:
|
||||
description: GitHub App Private Key
|
||||
required: true
|
||||
owner:
|
||||
description: Repository owner
|
||||
required: true
|
||||
repo:
|
||||
description: Repository name
|
||||
required: true
|
||||
from:
|
||||
description: Start point of collected issues (minutes ago)
|
||||
required: true
|
||||
|
|
|
@ -21,6 +21,8 @@ const from = fromInput ? (0, utils_1.daysAgoToHumanReadbleDate)(+fromInput * min
|
|||
const until = (0, utils_1.daysAgoToHumanReadbleDate)(+(0, utils_1.getRequiredInput)('until') * minToDay);
|
||||
const createdQuery = `created:` + (from ? `${from}..${until}` : `<${until}`);
|
||||
const blobContainer = (0, utils_1.getRequiredInput)('blobContainerName');
|
||||
const repo = (0, utils_1.getRequiredInput)('repo');
|
||||
const owner = (0, utils_1.getRequiredInput)('owner');
|
||||
class FetchIssues extends Action_1.Action {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
@ -28,7 +30,7 @@ class FetchIssues extends Action_1.Action {
|
|||
}
|
||||
async onTriggered(github) {
|
||||
var _a;
|
||||
const query = `${createdQuery} is:open no:assignee ${excludeLabels}`;
|
||||
const query = `repo:${owner}/${repo} ${createdQuery} is:open no:assignee ${excludeLabels}`;
|
||||
const data = [];
|
||||
for await (const page of github.query({ q: query })) {
|
||||
for (const issue of page) {
|
||||
|
|
|
@ -24,12 +24,13 @@ const until = daysAgoToHumanReadbleDate(+getRequiredInput('until') * minToDay);
|
|||
const createdQuery = `created:` + (from ? `${from}..${until}` : `<${until}`);
|
||||
|
||||
const blobContainer = getRequiredInput('blobContainerName');
|
||||
|
||||
const repo = getRequiredInput('repo');
|
||||
const owner = getRequiredInput('owner');
|
||||
class FetchIssues extends Action {
|
||||
id = 'Clasifier-Deep/Apply/FetchIssues';
|
||||
|
||||
async onTriggered(github: OctoKit) {
|
||||
const query = `${createdQuery} is:open no:assignee ${excludeLabels}`;
|
||||
const query = `repo:${owner}/${repo} ${createdQuery} is:open no:assignee ${excludeLabels}`;
|
||||
|
||||
const data: { number: number; contents: string }[] = [];
|
||||
for await (const page of github.query({ q: query })) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче