@@ -33854,6 +33854,13 @@ var config = {
3385433854 label: (0,core.getInput)('reproduction_invalid_label') || 'invalid-reproduction',
3385533855 linkSection: (0,core.getInput)('reproduction_link_section') || '### Link to reproduction(.*)### To reproduce',
3385633856 },
33857+ areaLabels: {
33858+ section: (0,core.getInput)('area_label_section') || '',
33859+ skip: ((0,core.getInput)('area_label_skip') || '')
33860+ .split(',')
33861+ .map(function (s) { return s.trim(); })
33862+ .filter(Boolean),
33863+ },
3385733864 actionsToPerform: ((0,core.getInput)('actions_to_perform') || validActionsToPerform.join(','))
3385833865 .split(',')
3385933866 .map(function (a) {
@@ -33925,7 +33932,7 @@ function checkValidReproduction() {
3392533932 case 4:
3392633933 // Adjust labels
3392733934 _f.sent();
33928- if (!! config.actionsToPerform.includes('tag')) return [3 /*break*/, 6];
33935+ if (!config.actionsToPerform.includes('tag')) return [3 /*break*/, 6];
3392933936 (0,core.info)("Added label: ".concat(config.invalidLink.label));
3393033937 return [4 /*yield*/, client.issues.addLabels(__assign(__assign({}, common), { labels: [config.invalidLink.label] }))];
3393133938 case 5:
@@ -34042,6 +34049,56 @@ function getCommentBody(pathOrComment) {
3404234049 });
3404334050 });
3404434051}
34052+ /**
34053+ * Apply area labels from the issue body dropdown selection
34054+ */
34055+ function checkAreaLabels() {
34056+ var _a, _b;
34057+ return __awaiter(this, void 0, Promise, function () {
34058+ var _c, issue, action, sectionRegex, match, labels, client, common, err_1;
34059+ return __generator(this, function (_d) {
34060+ switch (_d.label) {
34061+ case 0:
34062+ if (!config.areaLabels.section) {
34063+ (0,core.info)('Area labels - skipped, no section regex configured');
34064+ return [2 /*return*/];
34065+ }
34066+ _c = github.context.payload, issue = _c.issue, action = _c.action;
34067+ if (action !== 'opened' || !(issue === null || issue === void 0 ? void 0 : issue.body))
34068+ return [2 /*return*/];
34069+ sectionRegex = new RegExp(config.areaLabels.section, 'is');
34070+ match = (_b = (_a = issue.body.match(sectionRegex)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim();
34071+ if (!match) {
34072+ (0,core.info)('Area labels - no matching section found in issue body');
34073+ return [2 /*return*/];
34074+ }
34075+ labels = match
34076+ .split(',')
34077+ .map(function (l) { return l.trim(); })
34078+ .filter(function (l) { return l && !config.areaLabels.skip.includes(l); });
34079+ if (labels.length === 0) {
34080+ (0,core.info)('Area labels - no labels to apply after filtering');
34081+ return [2 /*return*/];
34082+ }
34083+ client = (0,github.getOctokit)(config.token).rest;
34084+ common = __assign(__assign({}, github.context.repo), { issue_number: issue.number });
34085+ _d.label = 1;
34086+ case 1:
34087+ _d.trys.push([1, 3, , 4]);
34088+ return [4 /*yield*/, client.issues.addLabels(__assign(__assign({}, common), { labels: labels }))];
34089+ case 2:
34090+ _d.sent();
34091+ (0,core.info)("Applied area labels: ".concat(labels.join(', ')));
34092+ return [3 /*break*/, 4];
34093+ case 3:
34094+ err_1 = _d.sent();
34095+ (0,core.error)("Failed to apply area labels: ".concat(err_1 instanceof Error ? err_1.message : err_1));
34096+ return [3 /*break*/, 4];
34097+ case 4: return [2 /*return*/];
34098+ }
34099+ });
34100+ });
34101+ }
3404534102function run() {
3404634103 return __awaiter(this, void 0, void 0, function () {
3404734104 var token, workspace, safeConfig;
@@ -34051,8 +34108,11 @@ function run() {
3405134108 token = config.token, workspace = config.workspace, safeConfig = __rest(config, ["token", "workspace"]);
3405234109 (0,core.info)('Configuration:');
3405334110 (0,core.info)(JSON.stringify(safeConfig, null, 2));
34054- return [4 /*yield*/, checkValidReproduction ()];
34111+ return [4 /*yield*/, checkAreaLabels ()];
3405534112 case 1:
34113+ _a.sent();
34114+ return [4 /*yield*/, checkValidReproduction()];
34115+ case 2:
3405634116 _a.sent();
3405734117 return [2 /*return*/];
3405834118 }
0 commit comments