Merge pull request #149 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2021-01-05 18:41:53 +01:00
committed by GitHub
7 changed files with 541 additions and 2895 deletions
+1 -1
View File
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright 2016 Mike Penz Copyright 2021 Mike Penz
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
+6 -6
View File
@@ -222,7 +222,7 @@ For advanced use cases additional settings can be provided to the action
### PR Template placeholders ### PR Template placeholders
Table of supported placeholders allowed to be used in the `pr_template` configuration. Table of supported placeholders allowed to be used in the `pr_template` configuration, which will be included in the release notes / changelog.
| **Placeholder** | **Description** | | **Placeholder** | **Description** |
|------------------|-------------------------------------------------------------| |------------------|-------------------------------------------------------------|
@@ -239,7 +239,7 @@ Table of supported placeholders allowed to be used in the `pr_template` configur
### Template placeholders ### Template placeholders
Table of supported placeholders allowed to be used in the `template` and `empty_template` (only supports placeholder marked for empty) configuration. Table of supported placeholders allowed to be used in the `template` and `empty_template` (only supports placeholder marked for empty) configuration, to give additional control on defining the contents of the release notes / changelog.
| **Placeholder** | **Description** | **Empty** | | **Placeholder** | **Description** | **Empty** |
|----------------------------|----------------------------------------------------------------------------------------------------|:---------:| |----------------------------|----------------------------------------------------------------------------------------------------|:---------:|
@@ -257,7 +257,7 @@ Table of supported placeholders allowed to be used in the `template` and `empty_
### Configuration Specification ### Configuration Specification
Table of descriptions for the `configuration.json` options. Table of descriptions for the `configuration.json` options to configure the resulting release notes / changelog.
| **Input** | **Description** | | **Input** | **Description** |
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -316,13 +316,13 @@ export GITHUB_TOKEN=your_personal_github_pat
## License ## License
Copyright for portions of pr-release-notes are held by Nikolay Blagoev, 2019-2020 as part of project pull-release-notes. Copyright for portions of pr-release-notes are held by Nikolay Blagoev, 2019-2020 as part of project pull-release-notes.
All other copyright for project pr-release-notes are held by Mike Penz, 2020. All other copyright for project pr-release-notes are held by Mike Penz, 2021.
## Fork License ## Fork License
All patches and changes applied to the original source are licensed under the Apache 2.0 license. All patches and changes applied to the original source are licensed under the Apache 2.0 license.
Copyright 2020 Mike Penz Copyright 2021 Mike Penz
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -336,7 +336,7 @@ All patches and changes applied to the original source are licensed under the Ap
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
## Sample result changelog ## Sample result release notes / changelog
<div align="center"> <div align="center">
<a href="https://github.com/mikepenz/release-changelog-builder-action/runs/1270879787"><img src=".github/images/release_changelog_builder_expanded.png"/></a> <a href="https://github.com/mikepenz/release-changelog-builder-action/runs/1270879787"><img src=".github/images/release_changelog_builder_expanded.png"/></a>
Generated Vendored
+11 -6
View File
@@ -333,7 +333,7 @@ function run() {
core.setOutput('changelog', result); core.setOutput('changelog', result);
// write the result in changelog to file if possible // write the result in changelog to file if possible
const outputFile = core.getInput('outputFile'); const outputFile = core.getInput('outputFile');
if (outputFile !== "") { if (outputFile !== '') {
core.debug(`Enabled writing the changelog to disk`); core.debug(`Enabled writing the changelog to disk`);
utils_1.writeOutput(repositoryPath, outputFile, result); utils_1.writeOutput(repositoryPath, outputFile, result);
} }
@@ -1231,10 +1231,7 @@ function resolveConfiguration(githubWorkspacePath, configurationFile) {
const configurationPath = path.resolve(githubWorkspacePath, configurationFile); const configurationPath = path.resolve(githubWorkspacePath, configurationFile);
core.debug(`configurationPath = '${configurationPath}'`); core.debug(`configurationPath = '${configurationPath}'`);
const providedConfiguration = readConfiguration(configurationPath); const providedConfiguration = readConfiguration(configurationPath);
if (!providedConfiguration) { if (providedConfiguration) {
core.info(`⚠️ Configuration provided, but it couldn't be found, or failed to parse. Fallback to Defaults`);
}
else {
configuration = providedConfiguration; configuration = providedConfiguration;
} }
} }
@@ -1245,12 +1242,20 @@ exports.resolveConfiguration = resolveConfiguration;
* Reads in the configuration from the JSON file * Reads in the configuration from the JSON file
*/ */
function readConfiguration(filename) { function readConfiguration(filename) {
let rawdata;
try {
rawdata = fs.readFileSync(filename, 'utf8');
}
catch (error) {
core.info(`⚠️ Configuration provided, but it couldn't be found. Fallback to Defaults.`);
return null;
}
try { try {
const rawdata = fs.readFileSync(filename, 'utf8');
const configurationJSON = JSON.parse(rawdata); const configurationJSON = JSON.parse(rawdata);
return configurationJSON; return configurationJSON;
} }
catch (error) { catch (error) {
core.info(`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`);
return null; return null;
} }
} }
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+503 -2869
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -42,15 +42,15 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.19", "@types/jest": "^26.0.19",
"@types/node": "^14.14.16", "@types/node": "^14.14.20",
"@typescript-eslint/parser": "^4.11.1", "@typescript-eslint/parser": "^4.12.0",
"@vercel/ncc": "^0.26.1", "@vercel/ncc": "^0.26.1",
"eslint": "^7.16.0", "eslint": "^7.17.0",
"eslint-plugin-github": "^4.1.1", "eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^24.1.3", "eslint-plugin-jest": "^24.1.3",
"jest": "^26.6.3", "jest": "^26.6.3",
"jest-circus": "^26.6.3", "jest-circus": "^26.6.3",
"js-yaml": "^3.14.1", "js-yaml": "^4.0.0",
"prettier": "2.2.1", "prettier": "2.2.1",
"ts-jest": "^26.4.4", "ts-jest": "^26.4.4",
"typescript": "^4.1.3" "typescript": "^4.1.3"
+13 -6
View File
@@ -51,11 +51,7 @@ export function resolveConfiguration(
) )
core.debug(`configurationPath = '${configurationPath}'`) core.debug(`configurationPath = '${configurationPath}'`)
const providedConfiguration = readConfiguration(configurationPath) const providedConfiguration = readConfiguration(configurationPath)
if (!providedConfiguration) { if (providedConfiguration) {
core.info(
`⚠️ Configuration provided, but it couldn't be found, or failed to parse. Fallback to Defaults`
)
} else {
configuration = providedConfiguration configuration = providedConfiguration
} }
} }
@@ -66,11 +62,22 @@ export function resolveConfiguration(
* Reads in the configuration from the JSON file * Reads in the configuration from the JSON file
*/ */
function readConfiguration(filename: string): Configuration | null { function readConfiguration(filename: string): Configuration | null {
let rawdata: string
try {
rawdata = fs.readFileSync(filename, 'utf8')
} catch (error) {
core.info(
`⚠️ Configuration provided, but it couldn't be found. Fallback to Defaults.`
)
return null
}
try { try {
const rawdata = fs.readFileSync(filename, 'utf8')
const configurationJSON: Configuration = JSON.parse(rawdata) const configurationJSON: Configuration = JSON.parse(rawdata)
return configurationJSON return configurationJSON
} catch (error) { } catch (error) {
core.info(
`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`
)
return null return null
} }
} }