Compare commits

..

No commits in common. "releases/v3" and "v3.17.2" have entirely different histories.

17 changed files with 157 additions and 265 deletions

View File

@ -295,39 +295,6 @@ jobs:
skip-commit: "true"
git-push: "false"
test-skip-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: git tag | xargs git tag -d
- name: Create fake tag
run: "git tag -a 'v0.55.8' -m 'v0.55.8'"
- run: "git add . && git commit --allow-empty -m 'fix: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
EXPECTED_TAG: 'v0.55.8'
SKIPPED_COMMIT: true
EXPECTED_NO_PUSH: true
SKIPPED_TAG: true
with:
github-token: ${{ secrets.github_token }}
skip-commit: 'true'
skip-tag: 'true'
git-push: 'false'
test-yaml:
runs-on: ubuntu-latest
steps:
@ -864,36 +831,3 @@ jobs:
env:
FILES: "test-file-pre-release.json"
EXPECTED_VERSION: "1.5.0"
test-input-file:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit --allow-empty -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: "dont-use-git"
EXPECTED_TAG: "v6.5.0"
with:
input-file: "./test-input-file.md"
github-token: ${{ secrets.github_token }}
version-file: "./test-file-empty.toml"
version-path: "package.version"
fallback-version: "6.5.0"
- name: Test output
run: node ./test-file-content.js
env:
OUTPUT_FILE: "CHANGELOG.md"
EXPECTED_FILE: "test-input-file.md"

View File

@ -1,36 +1,3 @@
# [3.19.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.18.1...v3.19.0) (2023-06-22)
### Features
* Add 'infile' option ([a858fad](https://github.com/TriPSs/conventional-changelog-action/commit/a858fade68261d33b8c91977bbe3c77f1d39521d))
## [3.18.1](https://github.com/TriPSs/conventional-changelog-action/compare/v3.18.0...v3.18.1) (2023-05-18)
### Bug Fixes
* execute git config commands synchronously ([1607ac7](https://github.com/TriPSs/conventional-changelog-action/commit/1607ac70d5942487fb67e1d412d57868d8decca9))
# [3.18.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.17.2...v3.18.0) (2022-11-29)
### Bug Fixes
* bad reference ([a19765d](https://github.com/TriPSs/conventional-changelog-action/commit/a19765d093dc22d5007a1574c6db5d40be9ddf97))
* output current version if there is no new ver ([b1e290f](https://github.com/TriPSs/conventional-changelog-action/commit/b1e290f44d9e4e0a29d536146cf1fb073172cf9d))
### Features
* add skip-tag to skip tagging a release ([22e862a](https://github.com/TriPSs/conventional-changelog-action/commit/22e862a0ab69410642c4182cd9ee27a23d8c63a0))
## [3.17.2](https://github.com/TriPSs/conventional-changelog-action/compare/v3.17.1...v3.17.2) (2022-11-23)
@ -51,3 +18,30 @@
# [3.17.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.16.0...v3.17.0) (2022-11-02)
### Features
* Add pre-release support ([14cc315](https://github.com/TriPSs/conventional-changelog-action/commit/14cc315abe788497f54c3eb3c734963ffbf6cc3e))
# [3.16.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.15.0...v3.16.0) (2022-11-01)
### Features
* Update action to node 16 ([08c1b12](https://github.com/TriPSs/conventional-changelog-action/commit/08c1b1237bb2dbed93fa7ecba9c334f094cb6b0b))
# [3.15.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.14.1...v3.15.0) (2022-09-20)
### Features
* Add `git-path` option ([96b4f2c](https://github.com/TriPSs/conventional-changelog-action/commit/96b4f2ca996f2193165c87e184b8a765102c814c)), closes [#178](https://github.com/TriPSs/conventional-changelog-action/issues/178)

View File

@ -15,16 +15,14 @@ This action will bump version, tag commit and generate a changelog with conventi
- **Optional** `git-path`: Path filter for the logs. If set, only commits that match the path filter will be considered. By default, we won't use this feature(empty string).
- **Optional** `preset`: Preset that is used from conventional commits. Default `angular`.
- **Optional** `tag-prefix`: Prefix for the git tags. Default `v`.
- **Optional** `input-file`: Read the changelog from this file. This will prepend the newly generated changelogs to the file's content.
- **Optional** `output-file`: File to output the changelog to. Default `CHANGELOG.md`, when providing `'false'` no file will be generated / updated.
- **Optional** `release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all. This input has no effect if `input-file` is used.
- **Optional** `version-file`: The path to the file that contains the version to bump (supports comma-separated list of file paths). Default `./package.json`.
- **Optional** `release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all.
- **Optional** `version-file`: The path to the file that contains the version to bump. Default `./package.json`.
- **Optional** `version-path`: The place inside the version file to bump. Default `version`.
- **Optional** `skip-git-pull`: Do not pull the repo before tagging. Ensure you full cloned the repo in the first place to get tags. Default `'false'`.
- **Optional** `skip-on-empty`: Boolean to specify if you want to skip empty release (no-changelog generated). This case occurred when you push `chore` commit with `angular` for example. Default `'true'`.
- **Optional** `skip-version-file`: Do not update the version file. Default `'false'`.
- **Optional** `skip-commit`: Do not create a release commit. Default `'false'`.
- **Optional** `skip-tag`: Do not tag the release. Helpful for using action to check if a release is going to be made. Default `'false'`.
- **Optional** `pre-commit`: Path to the pre-commit script file. No hook by default.
- **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'`. If `pre-release`is set to `true` it will default to the configured pre-release format (i.e. `'0.1.0-rc.0'`)
- **Optional** `config-file-path`: Path to the conventional changelog config file. If set, the preset setting will be ignored
@ -82,11 +80,9 @@ export function preTagGeneration(tag: string): string {}
```
### Config-File-Path
A config file to define the conventional commit settings. Use it if you need to override values like `issuePrefix` or `issueUrlFormat`. If you set a `config-file-path`, the `preset` setting will be ignored. Therefore use an existing config and override the values you want to adjust.
example:
```javascript
'use strict'
const config = require('conventional-changelog-conventionalcommits');
@ -96,7 +92,6 @@ module.exports = config({
"issueUrlFormat": "https://jira.example.com/browse/{{prefix}}{{id}}"
})
```
The specified path can be relative or absolute. If it is relative, then it will be based on the `GITHUB_WORKSPACE` path.
Make sure to install all required packages in the workflow before executing this action.
@ -114,19 +109,12 @@ Make sure to install all required packages in the workflow before executing this
Uses all the defaults
```yaml
permissions:
contents: write
- name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
```
Write permissions are required in order to enable `git push` when a new version is generated. In some configurations, the
default `secrets.github_token` may not have the correct permissions. You can check your default permissions by looking at
"Set up job" section of your GitHub action run log.
Overwrite everything
```yaml
@ -242,18 +230,41 @@ Use a deploy key
If you'd like to contribute to this project, all you need to do is clone and install [act](https://github.com/nektos/act) this project and run:
> Make sure that `main: 'src/index.js'` is updated to `main: '../src/index.js'` inside the `action.yml`
> Note: The image used is 18 gb!
```shell
$ yarn install
# To run / test one specific job
$ act -j <workflow job name> -P ubuntu-latest=catthehacker/ubuntu:full-20.04 --quiet
# Example
$ act -j test-json -P ubuntu-latest=catthehacker/ubuntu:full-20.04 --quiet
# To run / test json versioning
$ act -j test-json -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run all tests
$ act pull_request -P ubuntu-latest=catthehacker/ubuntu:full-20.04 --quiet
# To run / test git versioning
$ act -j test-git -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / test git fallback versioning
$ act -j test-git-fallback -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / test yaml versioning
$ act -j test-yaml -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / test toml versioning
$ act -j test-toml -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / test empty / new files test
$ act -j test-[json/toml/yaml]-[empty/new] -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run pre-commit test
$ act -j test-pre-commit -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / multiple files test
$ act -j multiple-files -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run / config file path test
$ act -j test-config-file-path -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
# To run pre-changelog-generation test
$ act -j test-pre-changelog-generation -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -s github_token=fake-token
```
## [License](./LICENSE)

View File

@ -56,17 +56,13 @@ inputs:
default: "v"
required: false
input-file:
description: "Read the changelog from this file. This will prepend the newly generated changelogs to the file's content"
required: false
output-file:
description: "File to output the changelog to"
default: "CHANGELOG.md"
required: false
release-count:
description: "Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all. This input has no effect if input-file is used"
description: "Number of releases to preserve in changelog"
default: "5"
required: false
@ -100,11 +96,6 @@ inputs:
default: "false"
required: false
skip-tag:
description: 'Do not tag the release. Helpful for using action to check if a release is going to be made'
default: 'false'
required: false
pre-commit:
description: "Path to the pre-commit script file"
required: false

2
node_modules/.package-lock.json generated vendored
View File

@ -1,7 +1,7 @@
{
"name": "conventional-changelog-action",
"version": "3.17.0",
"lockfileVersion": 3,
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@actions/core": {

View File

@ -1,6 +1,6 @@
{
"name": "conventional-changelog-action",
"version": "3.19.0",
"version": "3.17.2",
"description": "Github Action that generates a changelog with the Conventional Changelog CLI",
"keywords": [
"actions",

View File

@ -1,5 +1,4 @@
const fs = require('fs')
const { Readable } = require('stream');
const conventionalChangelog = require('conventional-changelog')
/**
@ -68,45 +67,12 @@ module.exports.generateStringChangelog = (tagPrefix, preset, version, releaseCou
* @param releaseCount
* @param config
* @param gitPath
* @param infile
* @returns {Promise<>}
*/
module.exports.generateFileChangelog = (tagPrefix, preset, version, fileName, releaseCount, config, gitPath, infile) => new Promise((resolve) => {
const changelogStream = getChangelogStream(tagPrefix, preset, version, infile ? 1 : releaseCount, config, gitPath)
// The default changelog output to be streamed first
const readStreams = [changelogStream]
// If an input-file is provided and release count is not 0
if (infile) {
// The infile is read synchronously to avoid repeatedly reading newly written content while it is being written
const buffer = fs.readFileSync(infile);
const readableStream = Readable.from(buffer);
// We add the stream as the next item for later pipe
readStreams.push(readableStream)
}
const writeStream = fs.createWriteStream(fileName)
let currentIndex = 0;
function pipeNextStream() {
if (currentIndex < readStreams.length) {
const currentStream = readStreams[currentIndex];
currentStream.pipe(writeStream, { end: false });
currentStream.once('end', () => {
currentIndex++;
pipeNextStream();
});
} else {
// All stream pipes have completed
writeStream.end();
resolve();
}
}
pipeNextStream();
module.exports.generateFileChangelog = (tagPrefix, preset, version, fileName, releaseCount, config, gitPath) => new Promise((resolve) => {
const changelogStream = getChangelogStream(tagPrefix, preset, version, releaseCount, config, gitPath)
changelogStream
.pipe(fs.createWriteStream(fileName))
.on('finish', resolve)
})

View File

@ -14,33 +14,30 @@ module.exports = new (class Git {
// Make the Github token secret
core.setSecret(githubToken)
const gitUserName = core.getInput('git-user-name')
const gitUserEmail = core.getInput('git-user-email')
const gitUrl = core.getInput('git-url')
// if the env is dont-use-git then we mock exec as we are testing a workflow
if (ENV === 'dont-use-git') {
this.exec = (command) => {
const fullCommand = `git ${command}`
console.log(`Skipping "${fullCommand}" because of test env`)
if (!fullCommand.includes('git remote set-url origin')) {
this.commandsRun.push(fullCommand)
}
}
}
}
init = async () => {
const gitUserName = core.getInput('git-user-name')
const gitUserEmail = core.getInput('git-user-email')
const gitUrl = core.getInput('git-url')
const githubToken = core.getInput('github-token')
// Set config
await this.config('user.name', gitUserName)
await this.config('user.email', gitUserEmail)
this.config('user.name', gitUserName)
this.config('user.email', gitUserEmail)
// Update the origin
if (githubToken) {
await this.updateOrigin(`http://x-access-token:${githubToken}@${gitUrl}/${GITHUB_REPOSITORY}.git`)
this.updateOrigin(`https://x-access-token:${githubToken}@${gitUrl}/${GITHUB_REPOSITORY}.git`)
}
}
@ -163,7 +160,7 @@ module.exports = new (class Git {
*/
testHistory = (branch) => {
if (ENV === 'dont-use-git') {
const { EXPECTED_TAG, SKIPPED_COMMIT, EXPECTED_NO_PUSH, SKIPPED_TAG, SKIPPED_PULL, SKIP_CI } = process.env
const { EXPECTED_TAG, SKIPPED_COMMIT, EXPECTED_NO_PUSH, SKIPPED_PULL, SKIP_CI } = process.env
const expectedCommands = [
'git config user.name "Conventional Changelog Action"',
@ -184,9 +181,7 @@ module.exports = new (class Git {
}
}
if(!SKIPPED_TAG) {
expectedCommands.push(`git tag -a ${EXPECTED_TAG} -m "${EXPECTED_TAG}"`)
}
expectedCommands.push(`git tag -a ${EXPECTED_TAG} -m "${EXPECTED_TAG}"`)
if (!EXPECTED_NO_PUSH) {
expectedCommands.push(`git push origin ${branch} --follow-tags`)

View File

@ -0,0 +1,59 @@
const path = require('path')
const fs = require('fs')
const core = require('@actions/core')
const packageJsonLoc = path.resolve(core.getInput('package-json'))
module.exports = {
/**
* Get's the project package.json
* @return {any}
*/
get: () => {
return JSON.parse(fs.readFileSync(packageJsonLoc))
},
/**
* Bumps the version in the package.json
*
* @param packageJson
* @param releaseType
* @return {*}
*/
bump: (packageJson, releaseType) => {
let [major, minor, patch] = packageJson.version.split('.')
switch (releaseType) {
case 'major':
major = parseInt(major, 10) + 1
minor = 0
patch = 0
break
case 'minor':
minor = parseInt(minor, 10) + 1
patch = 0
break
default:
patch = parseInt(patch, 10) + 1
}
// Update the package.json with the new version
packageJson.version = `${major}.${minor}.${patch}`
return packageJson
},
/**
* Update package.json
*
* @param packageJson
* @return {*}
*/
update: (packageJson) => (
fs.writeFileSync(packageJsonLoc, JSON.stringify(packageJson, null, 2))
),
}

View File

@ -41,12 +41,10 @@ async function run() {
const skipVersionFile = core.getBooleanInput('skip-version-file')
const skipCommit = core.getBooleanInput('skip-commit')
const skipEmptyRelease = core.getBooleanInput('skip-on-empty')
const skipTag = core.getBooleanInput('skip-tag')
const conventionalConfigFile = core.getInput('config-file-path')
const preChangelogGenerationFile = core.getInput('pre-changelog-generation')
const gitUrl = core.getInput('git-url')
const gitPath = core.getInput('git-path')
const infile = core.getInput('input-file')
const skipCi = core.getBooleanInput('skip-ci')
const createSummary = core.getBooleanInput('create-summary')
const prerelease = core.getBooleanInput('pre-release')
@ -73,10 +71,6 @@ async function run() {
core.info(`Using "${preCommitFile}" as pre-commit script`)
}
if (infile) {
core.info(`Using "${infile}" as input file`)
}
if (preChangelogGenerationFile) {
core.info(`Using "${preChangelogGenerationFile}" as pre-changelog-generation script`)
}
@ -84,8 +78,6 @@ async function run() {
core.info(`Skipping empty releases is "${skipEmptyRelease ? 'enabled' : 'disabled'}"`)
core.info(`Skipping the update of the version file is "${skipVersionFile ? 'enabled' : 'disabled'}"`)
await git.init()
if (!skipGitPull) {
core.info('Pull to make sure we have the full git history')
await git.pull()
@ -107,7 +99,6 @@ async function run() {
}
let newVersion
let oldVersion
// If skipVersionFile or skipCommit is true we use GIT to determine the new version because
// skipVersionFile can mean there is no version file and skipCommit can mean that the user
@ -122,7 +113,6 @@ async function run() {
)
newVersion = versioning.newVersion
oldVersion = versioning.oldVersion
} else {
const files = versionFile.split(',').map((f) => f.trim())
@ -138,7 +128,6 @@ async function run() {
)
newVersion = versioning[0].newVersion
oldVersion = versioning[0].oldVersion
}
let gitTag = `${tagPrefix}${newVersion}`
@ -167,7 +156,6 @@ async function run() {
if (skipEmptyRelease && cleanChangelog === '') {
core.info('Generated changelog is empty and skip-on-empty has been activated so we skip this step')
core.setOutput('version', oldVersion)
core.setOutput('skipped', 'true')
return
}
@ -177,7 +165,7 @@ async function run() {
// If output file === 'false' we don't write it to file
if (outputFile !== 'false') {
// Generate the changelog
await changelog.generateFileChangelog(tagPrefix, preset, newVersion, outputFile, releaseCount, config, gitPath, infile)
await changelog.generateFileChangelog(tagPrefix, preset, newVersion, outputFile, releaseCount, config, gitPath)
}
if (!skipCommit) {
@ -199,10 +187,7 @@ async function run() {
}
// Create the new tag
if (!skipTag)
await git.createTag(gitTag)
else
core.info('We not going to the tag the GIT changes')
await git.createTag(gitTag)
if (gitPush) {
try {
@ -260,4 +245,4 @@ process.on('unhandledRejection', (reason, promise) => {
core.setFailed(error)
});
run()
run()

View File

@ -9,7 +9,6 @@ module.exports = class BaseVersioning {
newVersion = null
oldVersion = null
/**
* Set some basic configurations
*

View File

@ -12,12 +12,12 @@ module.exports = class Git extends BaseVersioning {
const prerelease = core.getBooleanInput('pre-release')
gitSemverTags({ tagPrefix, skipUnstable: !prerelease }, async (err, tags) => {
this.oldVersion = tags.length > 0 ? tags.shift().replace(tagPrefix, '') : null
const currentVersion = tags.length > 0 ? tags.shift().replace(tagPrefix, '') : null
// Get the new version
this.newVersion = await bumpVersion(
releaseType,
this.oldVersion,
currentVersion,
)
// We are done

View File

@ -18,7 +18,6 @@ module.exports = class Json extends BaseVersioning {
// Parse the file
let jsonContent
let eol = fileContent.endsWith('\n') ? '\n' : ''
try {
jsonContent = JSON.parse(fileContent)
} catch (error) {
@ -31,22 +30,22 @@ module.exports = class Json extends BaseVersioning {
}
// Get the old version
this.oldVersion = objectPath.get(jsonContent, this.versionPath, null)
const oldVersion = objectPath.get(jsonContent, this.versionPath, null)
// Get the new version
this.newVersion = await bumpVersion(
releaseType,
this.oldVersion,
oldVersion,
)
core.info(`Bumped file "${this.fileLocation}" from "${this.oldVersion}" to "${this.newVersion}"`)
core.info(`Bumped file "${this.fileLocation}" from "${oldVersion}" to "${this.newVersion}"`)
// Update the content with the new version
objectPath.set(jsonContent, this.versionPath, this.newVersion)
// Update the file
this.update(
JSON.stringify(jsonContent, null, 2) + eol
JSON.stringify(jsonContent, null, 2),
)
}

View File

@ -17,25 +17,25 @@ module.exports = class Toml extends BaseVersioning {
// Read the file
const fileContent = this.read()
const tomlContent = toml.parse(fileContent)
this.oldVersion = objectPath.get(tomlContent, this.versionPath, null)
const oldVersion = objectPath.get(tomlContent, this.versionPath, null)
// Get the new version
this.newVersion = await bumpVersion(
releaseType,
this.oldVersion,
oldVersion,
)
// Update the file
if (this.oldVersion) {
if (oldVersion) {
// Get the name of where the version is in
const versionName = this.versionPath.split('.').pop()
core.info(`Bumped file "${this.fileLocation}" from "${this.oldVersion}" to "${this.newVersion}"`)
core.info(`Bumped file "${this.fileLocation}" from "${oldVersion}" to "${this.newVersion}"`)
this.update(
// We use replace instead of yaml.stringify so we can preserve white spaces and comments
fileContent.replace(
`${versionName} = "${this.oldVersion}"`,
`${versionName} = "${oldVersion}"`,
`${versionName} = "${this.newVersion}"`,
),
)

View File

@ -17,32 +17,32 @@ module.exports = class Yaml extends BaseVersioning {
// Read the file
const fileContent = this.read()
const yamlContent = yaml.parse(fileContent) || {}
this.oldVersion = objectPath.get(yamlContent, this.versionPath, null)
const oldVersion = objectPath.get(yamlContent, this.versionPath, null)
// Get the new version
this.newVersion = await bumpVersion(
releaseType,
this.oldVersion,
oldVersion,
)
// Update the file
if (this.oldVersion) {
if (oldVersion) {
// Get the name of where the version is in
const versionName = this.versionPath.split('.').pop()
core.info(`Bumped file "${this.fileLocation}" from "${this.oldVersion}" to "${this.newVersion}"`)
core.info(`Bumped file "${this.fileLocation}" from "${oldVersion}" to "${this.newVersion}"`)
this.update(
// We use replace instead of yaml.stringify so we can preserve white spaces and comments
// Replace if version was used with single quotes
fileContent.replace(
`${versionName}: '${this.oldVersion}'`,
`${versionName}: '${oldVersion}'`,
`${versionName}: '${this.newVersion}'`,
).replace( // Replace if version was used with double quotes
`${versionName}: "${this.oldVersion}"`,
`${versionName}: "${oldVersion}"`,
`${versionName}: "${this.newVersion}"`,
).replace( // Replace if version was used with no quotes
`${versionName}: ${this.oldVersion}`,
`${versionName}: ${oldVersion}`,
`${versionName}: ${this.newVersion}`,
),
)

View File

@ -1,30 +0,0 @@
const fs = require('fs')
const assert = require('assert')
const yaml = require('yaml')
const actionConfig = yaml.parse(fs.readFileSync('./action.yml', 'utf8'))
const {
OUTPUT_FILE = 'CHANGELOG.md',
EXPECTED_FILE = 'test-input-file.md',
} = process.env
assert.ok(OUTPUT_FILE, 'Output file is not defined!')
assert.ok(EXPECTED_FILE, 'Expected file is not defined!')
/**
* Test that the generated logs match the expected output
*/
console.log(`Going to test file "${OUTPUT_FILE}" against expected "${EXPECTED_FILE}"`)
const outputFileContent = fs.readFileSync(OUTPUT_FILE.trim(), 'utf8').split('\n');
assert.ok(outputFileContent, 'Content could not be parsed!')
console.log(`"${OUTPUT_FILE}" has valid content`, outputFileContent)
const expectedFileContent = fs.readFileSync(EXPECTED_FILE.trim(), 'utf8').split('\n');
assert.ok(expectedFileContent, 'Content could not be parsed!')
console.log(`"${EXPECTED_FILE}" has valid content`, expectedFileContent)
const linesToCompare = 11
assert.deepStrictEqual(outputFileContent.slice(linesToCompare * -1), expectedFileContent.slice(linesToCompare * -1), 'Output-file does not contain the expected input-file content')
console.log('The input-file\'s content exists at the end of the generated logs')

View File

@ -1,11 +0,0 @@
# This is content that will remain in the changelogs throughout all future releases
## [1.0.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.18.0...v3.18.1) (2023-05-18)
### Features
* Make another commit
### Bug Fixes
* Make a preexisting commit