Skip to content

Commit e074e37

Browse files
feat: Build for release
1 parent a743ae0 commit e074e37

28 files changed

+971
-597
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = tab
9+
indent_size = 4
10+
11+
[{*.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2

.eslintrc

+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:@typescript-eslint/eslint-recommended"
6+
],
7+
"plugins": [
8+
"@typescript-eslint"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"sourceType": "module",
13+
"ecmaVersion": 2018
14+
},
15+
"env": {
16+
"node": true,
17+
"jest": true,
18+
"es6": true,
19+
"browser": true
20+
},
21+
"settings": {
22+
"react": {
23+
"version": "latest"
24+
}
25+
},
26+
"rules": {
27+
"camelcase": [
28+
"error",
29+
{
30+
"properties": "always"
31+
}
32+
],
33+
"require-jsdoc": [
34+
"error",
35+
{
36+
"require": {
37+
"FunctionDeclaration": true,
38+
"MethodDefinition": true,
39+
"ClassDeclaration": true
40+
}
41+
}
42+
],
43+
"valid-jsdoc": [
44+
"error",
45+
{
46+
"requireReturn": false,
47+
"preferType": {
48+
"String": "string",
49+
"Object": "object",
50+
"Number": "number",
51+
"Function": "function",
52+
"Void": "void"
53+
}
54+
}
55+
],
56+
"quotes": [
57+
"error",
58+
"single",
59+
"avoid-escape"
60+
],
61+
"key-spacing": [
62+
"error",
63+
{
64+
"singleLine": {
65+
"beforeColon": false,
66+
"afterColon": true
67+
},
68+
"multiLine": {
69+
"beforeColon": false,
70+
"afterColon": true
71+
}
72+
}
73+
],
74+
"no-magic-numbers": [
75+
"error",
76+
{
77+
"ignoreArrayIndexes": true
78+
}
79+
],
80+
"eqeqeq": "error",
81+
"block-scoped-var": "error",
82+
"complexity": [
83+
"error",
84+
{
85+
"maximum": 20
86+
}
87+
],
88+
"curly": "error",
89+
"default-case": "error",
90+
"dot-location": [
91+
"error",
92+
"property"
93+
],
94+
"guard-for-in": "error",
95+
"no-eval": "error",
96+
"block-spacing": "error",
97+
"brace-style": "error",
98+
"comma-spacing": [
99+
"error",
100+
{
101+
"before": false,
102+
"after": true
103+
}
104+
],
105+
"id-length": [
106+
"error",
107+
{
108+
"min": 2,
109+
"properties": "never",
110+
"exceptions": [
111+
"$"
112+
]
113+
}
114+
],
115+
"indent": [
116+
"error",
117+
"tab",
118+
{
119+
"MemberExpression": "off"
120+
}
121+
],
122+
"space-before-function-paren": [
123+
"error",
124+
"never"
125+
],
126+
"space-before-blocks": "error",
127+
"prefer-const": "error",
128+
"no-var": "error",
129+
"arrow-body-style": "off",
130+
"arrow-spacing": "error",
131+
"strict": [
132+
"error"
133+
],
134+
"no-warning-comments": [
135+
"warn",
136+
{
137+
"terms": [
138+
"todo",
139+
"fixme",
140+
"hack"
141+
],
142+
"location": "anywhere"
143+
}
144+
],
145+
"semi": [
146+
"error"
147+
]
148+
}
149+
}

build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"tagName":"v1.0.3","branch":"gh-actions","tags":["v1.0.3","v1","v1.0"],"updated_at":"2019-08-31T06:03:44.963Z"}
1+
{"tagName":"v1.1.1","branch":"gh-actions","tags":["v1.1.1","v1","v1.1"],"updated_at":"2019-09-15T18:00:19.541Z"}

jest.setup.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
declare module NodeJS {
2+
interface Global {
3+
mockSignale: {
4+
info: jest.Mock,
5+
warn: jest.Mock
6+
}
7+
}
8+
}
9+
10+
global.mockSignale = {
11+
info: jest.fn(),
12+
warn: jest.fn(),
13+
};
14+
jest.mock('signale', () => ({
15+
...jest.requireActual('signale'),
16+
info: global.mockSignale.info,
17+
warn: global.mockSignale.warn,
18+
}));

lib/main.js

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const signale_1 = __importDefault(require("signale"));
1919
const misc_1 = require("./utils/misc");
2020
const context_1 = require("./utils/context");
2121
const github_2 = require("./utils/github");
22+
/**
23+
* run
24+
*/
2225
function run() {
2326
return __awaiter(this, void 0, void 0, function* () {
2427
try {

lib/utils/context.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.getAssignees = (context) => {
4-
const sender = getSender(context);
5-
if (false === sender)
6-
return false;
7-
const assignees = getCurrentAssignees(context);
8-
if (false === assignees)
9-
return false;
10-
if (assignees.includes(sender))
11-
return [];
12-
return [sender];
13-
};
143
const getSender = (context) => context.payload.sender && context.payload.sender.type === 'User' ? context.payload.sender.login : false;
154
const getCurrentAssignees = (context) => {
165
if ('issues' === context.eventName) {
@@ -21,3 +10,17 @@ const getCurrentAssignees = (context) => {
2110
}
2211
return false;
2312
};
13+
exports.getAssignees = (context) => {
14+
const sender = getSender(context);
15+
if (false === sender) {
16+
return false;
17+
}
18+
const assignees = getCurrentAssignees(context);
19+
if (false === assignees) {
20+
return false;
21+
}
22+
if (assignees.includes(sender)) {
23+
return [];
24+
}
25+
return [sender];
26+
};

lib/utils/github.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,23 @@ exports.addAssignees = (assignees, octokit, context) => __awaiter(void 0, void 0
2121
}
2222
signale_1.default.info('Adding assignees');
2323
signale_1.default.info(assignees);
24-
if (!assignees.length)
24+
if (!assignees.length) {
2525
return;
26-
yield octokit.issues.addAssignees({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
issue_number: context.issue.number,
30-
assignees: assignees,
31-
});
26+
}
27+
try {
28+
yield octokit.issues.addAssignees({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
'issue_number': context.issue.number,
32+
assignees: assignees,
33+
});
34+
}
35+
catch (error) {
36+
if ('Resource not accessible by integration' === error.message) {
37+
signale_1.default.warn(error.message);
38+
}
39+
else {
40+
throw error;
41+
}
42+
}
3243
});

0 commit comments

Comments
 (0)