From acc9cee2ce969aafe6a98056204f916da8050b98 Mon Sep 17 00:00:00 2001 From: marocchino Date: Fri, 22 Jan 2021 02:29:12 +0900 Subject: [PATCH] Fix unexpected delete fail --- README.md | 2 +- lib/main.js | 2 +- src/main.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89401d5..663fd87 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ with: Release ${{ github.sha }} to ``` -### Delete previous commit +### Delete previous comment ```yaml uses: marocchino/sticky-pull-request-comment@v2 diff --git a/lib/main.js b/lib/main.js index 2863040..6e5dd44 100644 --- a/lib/main.js +++ b/lib/main.js @@ -52,7 +52,7 @@ function run() { const githubToken = core.getInput("GITHUB_TOKEN", { required: true }); const octokit = github.getOctokit(githubToken); const previous = yield comment_1.findPreviousComment(octokit, repo, number, header); - if (!message && !path) { + if (!deleteOldComment && !message && !path) { throw { message: 'Either message or path input is required' }; } if (deleteOldComment && recreate) { diff --git a/src/main.ts b/src/main.ts index ccaaf63..6871a83 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,7 +24,7 @@ async function run() { const octokit = github.getOctokit(githubToken); const previous = await findPreviousComment(octokit, repo, number, header); - if (!message && !path) { + if (!deleteOldComment && !message && !path) { throw { message: 'Either message or path input is required' }; }