From a2d880068578f88d98215683bc2b4c8bd0872f3e Mon Sep 17 00:00:00 2001 From: Allan Lei Date: Mon, 25 Mar 2024 17:08:24 +0800 Subject: [PATCH] Fix: Bypass errors if `ignore-missing` is true --- dist/index.js | 4 ++-- src/main.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index c9ba9d4..53d1385 100644 --- a/dist/index.js +++ b/dist/index.js @@ -24761,7 +24761,7 @@ async function run() { (await fs_1.promises.readFile(core.getInput('changelog-file') || 'CHANGELOG.md', 'utf8')); } catch (err) { - if (err.code === 'ENOENT' && core.getBooleanInput('ignore-missing')) { + if (err.code === 'ENOENT') { changelogBody = ''; } else { @@ -24773,7 +24773,7 @@ async function run() { // Slice the start const versionStartIndex = changelog.findIndex(versionFilter({ versionText, versionMarkerType, versionMarkerDepth })); changelog = changelog.slice(versionStartIndex); - if (versionStartIndex === -1) { + if (versionStartIndex === -1 && !core.getBooleanInput('ignore-missing')) { return core.setFailed(`Could not find version ${versionText} in changelog`); } // Slice the end diff --git a/src/main.ts b/src/main.ts index c0d35ae..4af8d30 100644 --- a/src/main.ts +++ b/src/main.ts @@ -56,7 +56,7 @@ export async function run(): Promise { 'utf8' )) } catch (err) { - if (err.code === 'ENOENT' && core.getBooleanInput('ignore-missing')) { + if (err.code === 'ENOENT') { changelogBody = '' } else { throw err @@ -72,7 +72,7 @@ export async function run(): Promise { ) changelog = changelog.slice(versionStartIndex) - if (versionStartIndex === -1) { + if (versionStartIndex === -1 && !core.getBooleanInput('ignore-missing')) { return core.setFailed(`Could not find version ${versionText} in changelog`) }