Skip to content

Commit 04d3936

Browse files
committed
Release 1.3.1
1 parent 0c4c393 commit 04d3936

8,781 files changed

Lines changed: 2076062 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# comment this out distribution branches
2-
node_modules/
3-
lib
2+
# node_modules/
3+
# lib
44

55
# Editors
66
.vscode

lib/addCommentReaction.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __importStar = (this && this.__importStar) || function (mod) {
12+
if (mod && mod.__esModule) return mod;
13+
var result = {};
14+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15+
result["default"] = mod;
16+
return result;
17+
};
18+
Object.defineProperty(exports, "__esModule", { value: true });
19+
const github = __importStar(require("@actions/github"));
20+
const github_1 = require("./github");
21+
exports.addCommentReaction = (token, commentID) => __awaiter(void 0, void 0, void 0, function* () {
22+
const octokit = new github.GitHub(token);
23+
yield octokit.reactions.createForIssueComment(Object.assign(Object.assign({}, github_1.getRepo()), { comment_id: commentID, content: "+1" }));
24+
});

lib/checkKeyword.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.checkKeyword = (keywords, comment) => {
4+
return keywords.some((keyword) => {
5+
return comment.toLowerCase().includes(keyword.toLowerCase());
6+
});
7+
};

lib/github.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use strict";
2+
var __importStar = (this && this.__importStar) || function (mod) {
3+
if (mod && mod.__esModule) return mod;
4+
var result = {};
5+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6+
result["default"] = mod;
7+
return result;
8+
};
9+
Object.defineProperty(exports, "__esModule", { value: true });
10+
const github = __importStar(require("@actions/github"));
11+
exports.getPrNumber = () => {
12+
const pullRequest = github.context.payload.pull_request;
13+
if (!pullRequest) {
14+
return undefined;
15+
}
16+
return pullRequest.number;
17+
};
18+
exports.getIssueNumber = () => {
19+
const issue = github.context.payload.issue;
20+
if (!issue) {
21+
return undefined;
22+
}
23+
return issue.number;
24+
};
25+
exports.getRepo = () => {
26+
const repo = github.context.repo;
27+
return repo;
28+
};

lib/index.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __importStar = (this && this.__importStar) || function (mod) {
12+
if (mod && mod.__esModule) return mod;
13+
var result = {};
14+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15+
result["default"] = mod;
16+
return result;
17+
};
18+
Object.defineProperty(exports, "__esModule", { value: true });
19+
const addCommentReaction_1 = require("./addCommentReaction");
20+
const core = __importStar(require("@actions/core"));
21+
const checkKeyword_1 = require("./checkKeyword");
22+
const setIssueLabel_1 = require("./setIssueLabel");
23+
const setIssueAssignee_1 = require("./setIssueAssignee");
24+
const github = __importStar(require("@actions/github"));
25+
function run() {
26+
return __awaiter(this, void 0, void 0, function* () {
27+
const comment = github.context.payload.comment;
28+
if (!comment) {
29+
core.setFailed("Action can only be run on comments");
30+
return;
31+
}
32+
console.log(`comment': ${comment.body}`);
33+
try {
34+
core.setOutput("labeled", false.toString());
35+
core.setOutput("assigned", false.toString());
36+
const keywords = JSON.parse(core.getInput("keywords", { required: true }));
37+
console.log(`keywords: ${keywords}`);
38+
const token = core.getInput("github-token");
39+
const hasKeyword = checkKeyword_1.checkKeyword(keywords, comment.body);
40+
if (!hasKeyword) {
41+
console.log("Keyword not included in this issue comment");
42+
return;
43+
}
44+
addCommentReaction_1.addCommentReaction(token, comment.id);
45+
const labelsInput = core.getInput("labels");
46+
const assigneesInput = core.getInput("assignees");
47+
if (!labelsInput && !assigneesInput) {
48+
core.setFailed("labels or assignees input not found. Make sure your `.yml` file contains `labels` or `assignees`");
49+
}
50+
if (labelsInput) {
51+
const labels = JSON.parse(labelsInput);
52+
console.log(labels);
53+
setIssueLabel_1.setIssueLabel(token, labels);
54+
core.setOutput("labeled", true.toString());
55+
}
56+
if (assigneesInput) {
57+
const assignees = JSON.parse(assigneesInput);
58+
console.log(assignees);
59+
setIssueAssignee_1.setIssueAssignee(token, assignees);
60+
core.setOutput("assigned", true.toString());
61+
}
62+
}
63+
catch (error) {
64+
core.setFailed(error.message);
65+
}
66+
});
67+
}
68+
run();

lib/setIssueAssignee.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __importStar = (this && this.__importStar) || function (mod) {
12+
if (mod && mod.__esModule) return mod;
13+
var result = {};
14+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15+
result["default"] = mod;
16+
return result;
17+
};
18+
Object.defineProperty(exports, "__esModule", { value: true });
19+
const github = __importStar(require("@actions/github"));
20+
const github_1 = require("./github");
21+
exports.setIssueAssignee = (token, assignees) => __awaiter(void 0, void 0, void 0, function* () {
22+
const octokit = new github.GitHub(token);
23+
const issue_number = github_1.getIssueNumber();
24+
if (issue_number == null) {
25+
throw new Error("No Issue Provided");
26+
}
27+
yield octokit.issues.addAssignees(Object.assign(Object.assign({}, github_1.getRepo()), { issue_number,
28+
assignees }));
29+
});

lib/setIssueLabel.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __importStar = (this && this.__importStar) || function (mod) {
12+
if (mod && mod.__esModule) return mod;
13+
var result = {};
14+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15+
result["default"] = mod;
16+
return result;
17+
};
18+
Object.defineProperty(exports, "__esModule", { value: true });
19+
const github = __importStar(require("@actions/github"));
20+
const github_1 = require("./github");
21+
exports.setIssueLabel = (token, labels) => __awaiter(void 0, void 0, void 0, function* () {
22+
const octokit = new github.GitHub(token);
23+
const issue_number = github_1.getIssueNumber();
24+
if (issue_number == null) {
25+
throw new Error("No Issue Provided");
26+
}
27+
yield octokit.issues.addLabels(Object.assign(Object.assign({}, github_1.getRepo()), { issue_number, labels: labels }));
28+
});

node_modules/.bin/acorn

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/atob

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/escodegen

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)