Add ignore empty input

This commit is contained in:
Sam 2022-10-25 21:49:30 +00:00
parent 1d46172340
commit db01d1ad6c
6 changed files with 78 additions and 20 deletions

View file

@ -24,6 +24,9 @@ export const hideClassify = core.getInput("hide_classify", {
export const deleteOldComment = core.getBooleanInput("delete", {required: true})
export const hideOldComment = core.getBooleanInput("hide", {required: true})
export const githubToken = core.getInput("GITHUB_TOKEN", {required: true})
export const ignoreEmpty = core.getBooleanInput("ignore_empty", {
required: true
})
function buildRepo(): {repo: string; owner: string} {
return {
@ -34,8 +37,9 @@ function buildRepo(): {repo: string; owner: string} {
export async function getBody(): Promise<string> {
const pathInput = core.getMultilineInput("path", {required: false})
const followSymbolicLinks =
core.getInput("follow-symbolic-links").toLocaleUpperCase() !== "FALSE"
const followSymbolicLinks = core.getBooleanInput("follow_symbolic_links", {
required: true
})
if (pathInput && pathInput.length > 0) {
try {
const globber = await create(pathInput.join("\n"), {

View file

@ -12,7 +12,8 @@ import {
hideOldComment,
pullRequestNumber,
recreate,
repo
repo,
ignoreEmpty
} from "./config"
import {
createComment,
@ -32,6 +33,10 @@ async function run(): Promise<undefined> {
try {
const body = await getBody()
if (!body && ignoreEmpty) {
return
}
if (!deleteOldComment && !hideOldComment && !body) {
throw new Error("Either message or path input is required")
}