chore: add catch (#59)

* chore: add catch

* format
This commit is contained in:
xrkffgg
2021-02-03 09:28:14 +08:00
committed by GitHub
parent 65461c17ed
commit f743eedacb
2 changed files with 86 additions and 79 deletions

5
dist/index.js vendored
View File

@@ -8060,7 +8060,7 @@ async function doMarkDuplicate(owner, repo, labels) {
commentBody.split(' ')[0] == duplicateCommand) || commentBody.split(' ')[0] == duplicateCommand) ||
testDuplicate(commentBody)) testDuplicate(commentBody))
) { ) {
try {
const res = await octokit.repos.getCollaboratorPermissionLevel({ const res = await octokit.repos.getCollaboratorPermissionLevel({
owner, owner,
repo, repo,
@@ -8104,6 +8104,9 @@ async function doMarkDuplicate(owner, repo, labels) {
if (closeIssue == 'true') { if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber); await doCloseIssue(owner, repo, issueNumber);
} }
} catch (error) {
core.info(error.message);
}
} else { } else {
core.info( core.info(
`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`, `This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`,

View File

@@ -197,6 +197,7 @@ async function doMarkDuplicate(owner, repo, labels) {
commentBody.split(' ')[0] == duplicateCommand) || commentBody.split(' ')[0] == duplicateCommand) ||
testDuplicate(commentBody)) testDuplicate(commentBody))
) { ) {
try {
const res = await octokit.repos.getCollaboratorPermissionLevel({ const res = await octokit.repos.getCollaboratorPermissionLevel({
owner, owner,
repo, repo,
@@ -240,6 +241,9 @@ async function doMarkDuplicate(owner, repo, labels) {
if (closeIssue == 'true') { if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber); await doCloseIssue(owner, repo, issueNumber);
} }
} catch (error) {
core.info(error.message);
}
} else { } else {
core.info( core.info(
`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`, `This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`,