From d01e0807ef876d43b7070defe5102d82c0aed8d6 Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Wed, 9 Dec 2020 09:38:10 +0900 Subject: [PATCH] fix: change or->and to catch all errors --- dist/index.js | 7 +++++-- src/github-helper.ts | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index e515fbf6b7..cbc25fb8f2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -911,8 +911,11 @@ class GitHubHelper { }; } catch (e) { - if (!e.message || - !e.message.includes(`A pull request already exists for ${headBranch}`)) { + if (e.message && + e.message.includes(`A pull request already exists for ${headBranch}`)) { + core.info(`A pull request already exists for ${headBranch}`); + } + else { throw e; } } diff --git a/src/github-helper.ts b/src/github-helper.ts index 3ee7408e25..f03123036d 100644 --- a/src/github-helper.ts +++ b/src/github-helper.ts @@ -58,9 +58,11 @@ export class GitHubHelper { } } catch (e) { if ( - !e.message || - !e.message.includes(`A pull request already exists for ${headBranch}`) + e.message && + e.message.includes(`A pull request already exists for ${headBranch}`) ) { + core.info(`A pull request already exists for ${headBranch}`) + } else { throw e } }