Skip to content

Commit

Permalink
fix: 修复配置文件加载错误
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnAngela committed Sep 3, 2024
1 parent 44de19e commit e020337
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
16 changes: 14 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ async function commentRuleAnalyze(
}

if (checkAuthorAssociation(author_association, allowedAuthorAssociation)) {
if (Array.isArray(globs)) {
if (globs.length > 0) {
const matches = checkRegexes(issueContent, globs)
if (matches === false) {
continue
Expand Down Expand Up @@ -706,9 +706,11 @@ function parseRule(
const is_str = (x: unknown): boolean => typeof x === 'string'
const is_strarr = (x: unknown): boolean => Array.isArray(x)
const is_null = (x: unknown): boolean => x === null
const is_undefined = (x: unknown): boolean => x === undefined
const nopred = (x: unknown): unknown => x
const pred_2arr = (x: unknown): unknown[] => [x]
const pred_2emptystr = (): string => ''
const pred_2emptyarr = () => []

const str2str: ICondPred = {
cond: is_str,
Expand All @@ -726,13 +728,23 @@ function parseRule(
cond: is_null,
pred: pred_2emptystr
}
const undefined2undefined: ICondPred = {
cond: is_undefined,
pred: nopred
}
const undefined2emptyarr: ICondPred = {
cond: is_undefined,
pred: pred_2emptyarr
}

const configMap: { [key: string]: ICondPred[] } = {
...appendConfigMap,
name: [str2str],
content: [str2str, null2str],
author_association: [str2strarr, strarr2strarr],
regexes: [str2strarr, strarr2strarr],
regexes: [str2strarr, strarr2strarr, undefined2emptyarr],
url_mode: [str2strarr, strarr2strarr, undefined2undefined],
url_list: [str2strarr, strarr2strarr, undefined2undefined],
skip_if: [str2strarr, strarr2strarr]
}
const itemParams: IRuleBase = {
Expand Down

0 comments on commit e020337

Please sign in to comment.