Merge pull request #1334 from mikepenz/adjust/1331_5.x

Enhance error log in case of a fatal error building the changelog
This commit is contained in:
Mike Penz
2024-04-11 08:34:47 +02:00
committed by GitHub
6 changed files with 30 additions and 31 deletions
+20 -23
View File
@@ -1,6 +1,6 @@
import {mergeConfiguration, resolveConfiguration} from '../../src/utils' import {mergeConfiguration, resolveConfiguration} from '../../src/utils'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder'
import { GithubRepository } from '../../src/repositories/GithubRepository' import {GithubRepository} from '../../src/repositories/GithubRepository'
jest.setTimeout(180000) jest.setTimeout(180000)
@@ -12,34 +12,31 @@ it('Test custom changelog builder', async () => {
// define the configuration file to use. // define the configuration file to use.
// By default it retireves a configuration from a json file // By default it retireves a configuration from a json file
// You can also quickly modify in code. // You can also quickly modify in code.
const configuration = mergeConfiguration(undefined, resolveConfiguration( const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs/configuration.json'))
'',
'configs/configuration.json'
))
// Demo to modify the configuration further in code // Demo to modify the configuration further in code
// configuration.pr_template = "#{{TITLE}}" // configuration.pr_template = "#{{TITLE}}"
const releaseNotesBuilder = new ReleaseNotesBuilder( const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // The base url used for the API requests (not needed for normal github) null, // The base url used for the API requests (not needed for normal github)
githubRepository, // Repository implementation (allows tu test gitea). Keep default for GitHub githubRepository, // Repository implementation (allows tu test gitea). Keep default for GitHub
'.', // Root path to the checked out sources. Commonly keep as default '.', // Root path to the checked out sources. Commonly keep as default
'mikepenz', // The owner of the repo to test 'mikepenz', // The owner of the repo to test
'release-changelog-builder-action-playground', // The repository name 'release-changelog-builder-action-playground', // The repository name
'1.5.0', // `fromTag` The from tag name or the SHA1 of the from commit '1.5.0', // `fromTag` The from tag name or the SHA1 of the from commit
'2.0.0', // `toTag` The to tag name or the SHA1 of the to commit '2.0.0', // `toTag` The to tag name or the SHA1 of the to commit
false, // `includeOpen` Define if you want to include open PRs into the changelog false, // `includeOpen` Define if you want to include open PRs into the changelog
false, // `failOnError` Define if the action should fail on errors false, // `failOnError` Define if the action should fail on errors
false, // `ignorePrePrelease` used if no `fromTag` is defined to resolve the prior tag false, // `ignorePrePrelease` used if no `fromTag` is defined to resolve the prior tag
false, // `fetchViaCommits` enable to fetch via commits false, // `fetchViaCommits` enable to fetch via commits
false, // `fetchReviewers` Enables fetching of reviewers for building the changlog (does additional API requests) false, // `fetchReviewers` Enables fetching of reviewers for building the changlog (does additional API requests)
false, // `fetchReleaseInformation` Enable to fetch release information (does additional API requests) false, // `fetchReleaseInformation` Enable to fetch release information (does additional API requests)
false, // `fetchReviews` Enable to fetch reviews of the PRs (does additional API requests) false, // `fetchReviews` Enable to fetch reviews of the PRs (does additional API requests)
'PR', // `mode` Set the mode to use [PR, COMMIT, HYBRID]. PR -> builds changelog using PRs, COMMIT -> using commits, HYBRID -> Uses both 'PR', // `mode` Set the mode to use [PR, COMMIT, HYBRID]. PR -> builds changelog using PRs, COMMIT -> using commits, HYBRID -> Uses both
false, // `exportCache` Exports the fethced information to the cahce. Not relevant for this test false, // `exportCache` Exports the fethced information to the cahce. Not relevant for this test
false, // `exportOnly` Enables to only export the fetched information however not build a changleog false, // `exportOnly` Enables to only export the fetched information however not build a changleog
null, // `cache` Path to the cache. Not relevant for this test. null, // `cache` Path to the cache. Not relevant for this test.
configuration // The configuration to use for building the changelog configuration // The configuration to use for building the changelog
) )
const changeLog = await releaseNotesBuilder.build() const changeLog = await releaseNotesBuilder.build()
Generated Vendored
+1
View File
@@ -217,6 +217,7 @@ function run() {
} }
catch (error /* eslint-disable-line @typescript-eslint/no-explicit-any */) { catch (error /* eslint-disable-line @typescript-eslint/no-explicit-any */) {
core.setFailed(error.message); core.setFailed(error.message);
core.error(`🔥 Failed to generate changelog due to ${JSON.stringify(error)}`);
} }
}); });
} }
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "release-changelog-builder-action", "name": "release-changelog-builder-action",
"version": "v4.1.0", "version": "v5.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "release-changelog-builder-action", "name": "release-changelog-builder-action",
"version": "v4.1.0", "version": "v5.0.0",
"license": "Apache 2.0", "license": "Apache 2.0",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "release-changelog-builder-action", "name": "release-changelog-builder-action",
"version": "v4.1.0", "version": "v5.0.0",
"private": true, "private": true,
"description": "A GitHub action that builds your release notes / changelog fast, easy and exactly the way you want.", "description": "A GitHub action that builds your release notes / changelog fast, easy and exactly the way you want.",
"main": "lib/main.js", "main": "lib/main.js",
+1
View File
@@ -111,6 +111,7 @@ async function run(): Promise<void> {
} }
} catch (error: any /* eslint-disable-line @typescript-eslint/no-explicit-any */) { } catch (error: any /* eslint-disable-line @typescript-eslint/no-explicit-any */) {
core.setFailed(error.message) core.setFailed(error.message)
core.error(`🔥 Failed to generate changelog due to ${JSON.stringify(error)}`)
} }
} }