From c61db84ae578f30fdc5239e57942502b681b7f22 Mon Sep 17 00:00:00 2001 From: miroslavpojer Date: Mon, 22 Jan 2024 15:28:42 +0100 Subject: [PATCH] - Debugging and fixes. --- dist/index.js | 18 ++++++------------ scripts/generate-release-notes.js | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0f7cfa48..37e660c8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31287,25 +31287,19 @@ async function run() { const repoOwner = github.context.repo.owner; const repoName = github.context.repo.repo; const githubToken = process.env.GITHUB_TOKEN; + const tagName = core.getInput('tag-name'); // Validate environment variables and arguments - if (!githubToken || !repoOwner || !repoName) { + if (!githubToken || !repoOwner || !repoName || !tagName) { core.setFailed("Missing required inputs or environment variables."); return; } - const tagName = core.getInput('tag-name'); - const chaptersJson = core.getInput('chapters'); - if (core.getInput('warnings')) { - const warnings = core.getInput('warnings').toLowerCase() === 'true'; - } + const chaptersJson = core.getInput('chapters') || "[]"; + const warnings = core.getInput('warnings') ? core.getInput('warnings').toLowerCase() === 'true' : true; const skipLabel = core.getInput('skip-release-notes-label') || 'skip-release-notes'; - if (core.getInput('print-empty-chapters')) { - const printEmptyChapters = core.getInput('print-empty-chapters').toLowerCase() === 'true'; - } - if (core.getInput('published-at')) { - const usePublishedAt = core.getInput('published-at').toLowerCase() === 'true'; - } + const usePublishedAt = core.getInput('published-at') ? core.getInput('published-at').toLowerCase() === 'true' : false; + const printEmptyChapters = core.getInput('print-empty-chapters') ? core.getInput('print-empty-chapters').toLowerCase() === 'true' : true; const octokit = new Octokit({ auth: githubToken }); diff --git a/scripts/generate-release-notes.js b/scripts/generate-release-notes.js index 42800453..97ac3ae0 100644 --- a/scripts/generate-release-notes.js +++ b/scripts/generate-release-notes.js @@ -384,25 +384,19 @@ async function run() { const repoOwner = github.context.repo.owner; const repoName = github.context.repo.repo; const githubToken = process.env.GITHUB_TOKEN; + const tagName = core.getInput('tag-name'); // Validate environment variables and arguments - if (!githubToken || !repoOwner || !repoName) { + if (!githubToken || !repoOwner || !repoName || !tagName) { core.setFailed("Missing required inputs or environment variables."); return; } - const tagName = core.getInput('tag-name'); - const chaptersJson = core.getInput('chapters'); - if (core.getInput('warnings')) { - const warnings = core.getInput('warnings').toLowerCase() === 'true'; - } + const chaptersJson = core.getInput('chapters') || "[]"; + const warnings = core.getInput('warnings') ? core.getInput('warnings').toLowerCase() === 'true' : true; const skipLabel = core.getInput('skip-release-notes-label') || 'skip-release-notes'; - if (core.getInput('print-empty-chapters')) { - const printEmptyChapters = core.getInput('print-empty-chapters').toLowerCase() === 'true'; - } - if (core.getInput('published-at')) { - const usePublishedAt = core.getInput('published-at').toLowerCase() === 'true'; - } + const usePublishedAt = core.getInput('published-at') ? core.getInput('published-at').toLowerCase() === 'true' : false; + const printEmptyChapters = core.getInput('print-empty-chapters') ? core.getInput('print-empty-chapters').toLowerCase() === 'true' : true; const octokit = new Octokit({ auth: githubToken });