Merge pull request #1425 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2025-01-27 12:09:56 +01:00
committed by GitHub
43 changed files with 11565 additions and 11387 deletions
-3
View File
@@ -1,3 +0,0 @@
dist/
lib/
node_modules/
-58
View File
@@ -1,58 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"filenames/match-regex": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/named": "off",
"no-unused-vars": "off",
"sort-imports": "off",
"i18n-text/no-en": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
+5 -4
View File
@@ -1,10 +1,7 @@
version: 2 version: 2
updates: updates:
# Enable version updates for npm
- package-ecosystem: 'npm' - package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory
directory: '/' directory: '/'
# Check the npm registry for updates every day (weekdays)
schedule: schedule:
interval: 'weekly' interval: 'weekly'
groups: groups:
@@ -17,4 +14,8 @@ updates:
- "js-yaml" - "js-yaml"
- "prettier" - "prettier"
- "ts-jest" - "ts-jest"
- "typescript" - "typescript"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
+2 -2
View File
@@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set Node.js 20.x - name: Set Node.js 20.x
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20.x node-version: 20.x
@@ -48,7 +48,7 @@ jobs:
id: diff id: diff
# If index.js was different than expected, upload the expected version as an artifact # If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with: with:
name: dist name: dist
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set Node.js 20.x - name: Set Node.js 20.x
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20.x node-version: 20.x
+3 -3
View File
@@ -47,7 +47,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -58,7 +58,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v2 uses: github/codeql-action/autobuild@v3
# ️ Command-line programs to run using the OS shell. # ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
@@ -72,4 +72,4 @@ jobs:
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v3
+3 -2
View File
@@ -1,5 +1,6 @@
import {clear} from '../src/transform'
import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils' import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils.js'
import { clear } from "../src/transform.js";
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+3 -3
View File
@@ -1,6 +1,6 @@
import {mergeConfiguration, resolveConfiguration} from '../../src/utils' import {mergeConfiguration, resolveConfiguration} from '../../src/utils.js'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js'
import {GithubRepository} from '../../src/repositories/GithubRepository' import {GithubRepository} from '../../src/repositories/GithubRepository.js'
jest.setTimeout(180000) jest.setTimeout(180000)
@@ -1,7 +1,7 @@
import {mergeConfiguration, resolveConfiguration} from '../../src/utils' import {mergeConfiguration, resolveConfiguration} from '../../src/utils.js'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js'
import {GiteaRepository} from '../../src/repositories/GiteaRepository' import {GiteaRepository} from '../../src/repositories/GiteaRepository.js'
import {clear} from '../../src/transform' import {clear} from '../../src/transform.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -1,9 +1,9 @@
import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../../src/utils' import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../../src/utils.js'
import {buildChangelog} from '../../src/transform' import {buildChangelog} from '../../src/transform.js'
import {Options, pullData} from '../../src/pr-collector/prCollector' import {Options, pullData} from '../../src/pr-collector/prCollector.js'
import {GiteaRepository} from '../../src/repositories/GiteaRepository' import {GiteaRepository} from '../../src/repositories/GiteaRepository.js'
import {clear} from '../../src/transform' import {clear} from '../../src/transform.js'
import {ReleaseNotesOptions} from '../../src/releaseNotesBuilder' import {ReleaseNotesOptions} from '../../src/releaseNotesBuilder.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1 -1
View File
@@ -2,7 +2,7 @@ import * as path from 'path'
import * as process from 'process' import * as process from 'process'
import * as cp from 'child_process' import * as cp from 'child_process'
import * as fs from 'fs' import * as fs from 'fs'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+3 -3
View File
@@ -1,6 +1,6 @@
import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils' import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils.js'
import {Regex} from '../src/pr-collector/types' import {Regex} from '../src/pr-collector/types.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+4 -4
View File
@@ -1,7 +1,7 @@
import {mergeConfiguration, resolveConfiguration} from '../src/utils' import {mergeConfiguration, resolveConfiguration} from '../src/utils.js'
import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder.js'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+6 -6
View File
@@ -1,9 +1,9 @@
import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../src/utils' import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../src/utils.js'
import {buildChangelog} from '../src/transform' import {buildChangelog} from '../src/transform.js'
import {Options, pullData} from '../src/pr-collector/prCollector' import {Options, pullData} from '../src/pr-collector/prCollector.js'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
import {ReleaseNotesOptions} from '../src/releaseNotesBuilder' import {ReleaseNotesOptions} from '../src/releaseNotesBuilder.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+4 -4
View File
@@ -1,7 +1,7 @@
import {TagResolver} from '../src/configuration' import {TagResolver} from '../src/configuration.js'
import {validateRegex} from '../src/pr-collector/regexUtils' import {validateRegex} from '../src/pr-collector/regexUtils.js'
import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags' import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+7 -7
View File
@@ -1,11 +1,11 @@
import {buildChangelog} from '../src/transform' import {buildChangelog} from '../src/transform.js'
import moment from 'moment' import moment from 'moment'
import {Configuration, DefaultConfiguration} from '../src/configuration' import {DefaultConfiguration} from '../src/configuration.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests' import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {DefaultDiffInfo} from '../src/pr-collector/commits' import {DefaultDiffInfo} from '../src/pr-collector/commits.js'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
import {buildChangelogTest} from './utils' import { buildChangelogTest } from "./utils.js";
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+5 -5
View File
@@ -1,9 +1,9 @@
import moment from 'moment' import moment from 'moment'
import {DefaultConfiguration} from '../src/configuration' import {DefaultConfiguration} from '../src/configuration.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests' import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform' import {clear} from '../src/transform.js'
import {buildChangelogTest, buildPullRequeset} from './utils' import {buildChangelogTest, buildPullRequeset} from './utils.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+5 -5
View File
@@ -1,8 +1,8 @@
import {Configuration} from '../src/configuration' import {Configuration} from '../src/configuration.js'
import {DefaultDiffInfo} from '../src/pr-collector/commits' import {DefaultDiffInfo} from '../src/pr-collector/commits.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests' import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {buildChangelog} from '../src/transform' import {buildChangelog} from '../src/transform.js'
import {BaseRepository} from '../src/repositories/BaseRepository' import {BaseRepository} from '../src/repositories/BaseRepository.js'
import moment from 'moment' import moment from 'moment'
export const buildChangelogTest = (config: Configuration, prs: PullRequestInfo[], repositoryUtils: BaseRepository): string => { export const buildChangelogTest = (config: Configuration, prs: PullRequestInfo[], repositoryUtils: BaseRepository): string => {
+1 -1
View File
@@ -21,7 +21,7 @@
"labels": ["dependencies"] "labels": ["dependencies"]
} }
], ],
"template": "#{{CHANGELOG}}\n\nContributors:\n- #{{CONTRIBUTORS}}", "template": "#{{CHANGELOG}}\n## Contributors:\n- #{{CONTRIBUTORS}}",
"max_pull_requests": 1000, "max_pull_requests": 1000,
"max_back_track_time_days": 1000 "max_back_track_time_days": 1000
} }
Generated Vendored
+9391 -10150
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+3
View File
@@ -0,0 +1,3 @@
{
"type": "module"
}
+1
View File
File diff suppressed because one or more lines are too long
+104
View File
@@ -0,0 +1,104 @@
import jest from "eslint-plugin-jest";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [{
ignores: ["**/dist/", "**/lib/", "**/node_modules/"]
}, ...compat.extends("plugin:github/recommended"), {
files: ["src/**.ts", "__tests__/**.ts"],
plugins: {
jest,
"@typescript-eslint": typescriptEslint
},
languageOptions: {
globals: {
...globals.node,
...jest.environments.globals.globals
},
parser: tsParser,
ecmaVersion: 9,
sourceType: "module",
parserOptions: {
project: "./tsconfig.json"
}
},
rules: {
"filenames/match-regex": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/named": "off",
"no-unused-vars": "off",
"sort-imports": "off",
"i18n-text/no-en": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {
accessibility: "no-public"
}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
camelcase: "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {
allowExpressions: true
}],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
semi: "off",
"@typescript-eslint/unbound-method": "error"
},
settings: {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"moduleDirectory": ["src", "node_modules"]
}
}
}
}];
+9 -8
View File
@@ -1,11 +1,12 @@
module.exports = { // jest.config.js
import { createJsWithTsEsmPreset } from "ts-jest";
export default {
clearMocks: true, clearMocks: true,
moduleFileExtensions: ['js', 'ts'], testEnvironment: "node",
testEnvironment: 'node', testMatch: ["**/*.test.ts"],
testMatch: ['**/*.test.ts'], testRunner: "jest-circus/runner",
testRunner: 'jest-circus/runner', moduleNameMapper: {
transform: { "(.+)\\.js": "$1",
'^.+\\.ts$': 'ts-jest'
}, },
verbose: true ...createJsWithTsEsmPreset(),
} }
+1885 -997
View File
File diff suppressed because it is too large Load Diff
+25 -17
View File
@@ -1,14 +1,15 @@
{ {
"name": "release-changelog-builder-action", "name": "release-changelog-builder-action",
"version": "v5.0.0", "version": "v5.1.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",
"type": "module",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"format": "prettier --write **/*.ts **/**/*.ts", "format": "prettier --write src/**.ts",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check src/**.ts",
"format-fix": "eslint --fix src/**/*.ts", "format-fix": "eslint --fix src/**.ts",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt", "package": "ncc build --source-map --license licenses.txt",
"test": "jest", "test": "jest",
@@ -40,28 +41,35 @@
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@octokit/rest": "^20.1.1", "@octokit/rest": "^20.1.1",
"gitea-js": "^1.22.0", "gitea-js": "^1.23.0",
"https-proxy-agent": "^7.0.5", "globals": "^15.14.0",
"https-proxy-agent": "^7.0.6",
"moment": "^2.30.1", "moment": "^2.30.1",
"semver": "^7.6.3" "semver": "^7.6.3"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^22.8.6", "@types/node": "^22.10.10",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.17.0", "@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^7.17.0", "@typescript-eslint/parser": "^8.21.0",
"@vercel/ncc": "^0.38.2", "@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0", "eslint": "^9.19.0",
"eslint-plugin-github": "^5.0.1", "eslint-plugin-github": "^5.1.5",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.7.0", "eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.3",
"eslint-import-resolver-typescript": "^3.7.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "3.3.3", "prettier": "3.4.2",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"typescript": "^5.6.3" "typescript": "^5.7.3",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.19.0"
},
"overrides": {
"glob": "11.0.1"
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
import {Extractor, PullConfiguration, Regex, Rule} from './pr-collector/types' import {Extractor, PullConfiguration, Regex, Rule} from './pr-collector/types.js'
export interface Configuration extends PullConfiguration { export interface Configuration extends PullConfiguration {
template: string template: string
+5 -5
View File
@@ -1,10 +1,10 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {mergeConfiguration, parseConfiguration, resolveConfiguration, resolveMode, retrieveRepositoryPath, writeOutput} from './utils' import {mergeConfiguration, parseConfiguration, resolveConfiguration, resolveMode, retrieveRepositoryPath, writeOutput} from './utils.js'
import {ReleaseNotesBuilder} from './releaseNotesBuilder' import {ReleaseNotesBuilder} from './releaseNotesBuilder.js'
import {Configuration} from './configuration' import {Configuration} from './configuration.js'
import {GithubRepository} from './repositories/GithubRepository' import {GithubRepository} from './repositories/GithubRepository.js'
import {GiteaRepository} from './repositories/GiteaRepository' import {GiteaRepository} from './repositories/GiteaRepository.js'
async function run(): Promise<void> { async function run(): Promise<void> {
const supportedPlatform = { const supportedPlatform = {
+4 -4
View File
@@ -1,9 +1,9 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import moment from 'moment' import moment from 'moment'
import {failOrError} from './utils' import {failOrError} from './utils.js'
import {PullRequestInfo} from './pullRequests' import {PullRequestInfo} from './pullRequests.js'
import {Options} from './prCollector' import {Options} from './prCollector.js'
import {BaseRepository} from '../repositories/BaseRepository' import {BaseRepository} from '../repositories/BaseRepository.js'
export interface DiffInfo { export interface DiffInfo {
changedFiles: number changedFiles: number
+1 -1
View File
@@ -1,6 +1,6 @@
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import * as io from '@actions/io' import * as io from '@actions/io'
import {directoryExistsSync} from './utils' import {directoryExistsSync} from './utils.js'
export async function createCommandManager(workingDirectory: string): Promise<GitCommandManager> { export async function createCommandManager(workingDirectory: string): Promise<GitCommandManager> {
return await GitCommandManager.createCommandManager(workingDirectory) return await GitCommandManager.createCommandManager(workingDirectory)
+6 -6
View File
@@ -1,10 +1,10 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {PullConfiguration} from './types' import {PullConfiguration} from './types.js'
import {TagInfo, Tags} from './tags' import {TagInfo, Tags} from './tags.js'
import {failOrError} from './utils' import {failOrError} from './utils.js'
import {PullRequestInfo, PullRequests} from './pullRequests' import {PullRequestInfo, PullRequests} from './pullRequests.js'
import {Commits, DefaultDiffInfo, DiffInfo, convertCommitsToPrs} from './commits' import {Commits, DefaultDiffInfo, DiffInfo, convertCommitsToPrs} from './commits.js'
import {BaseRepository} from '../repositories/BaseRepository' import {BaseRepository} from '../repositories/BaseRepository.js'
export interface Options { export interface Options {
owner: string // the owner of the repository owner: string // the owner of the repository
+4 -4
View File
@@ -1,10 +1,10 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {RestEndpointMethodTypes} from '@octokit/rest' import {RestEndpointMethodTypes} from '@octokit/rest'
import moment from 'moment' import moment from 'moment'
import {Property, Sort} from './types' import {Property, Sort} from './types.js'
import {Commits, DiffInfo, filterCommits} from './commits' import {Commits, DiffInfo, filterCommits} from './commits.js'
import {Options} from './prCollector' import {Options} from './prCollector.js'
import {BaseRepository} from '../repositories/BaseRepository' import {BaseRepository} from '../repositories/BaseRepository.js'
export interface PullRequestInfo { export interface PullRequestInfo {
number: number number: number
+2 -2
View File
@@ -1,5 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {Extractor, Property, Regex, RegexTransformer} from './types' import {Extractor, Property, Regex, RegexTransformer} from './types.js'
export function validateRegex(regex?: Regex): RegexTransformer | null { export function validateRegex(regex?: Regex): RegexTransformer | null {
if (regex === undefined) { if (regex === undefined) {
@@ -21,7 +21,7 @@ export function validateRegex(regex?: Regex): RegexTransformer | null {
} }
return buildRegex(regex, target, onProperty, method, onEmpty) return buildRegex(regex, target, onProperty, method, onEmpty)
} catch (e) { } catch {
core.warning(`⚠️ Failed to validate transformer: ${regex.pattern}`) core.warning(`⚠️ Failed to validate transformer: ${regex.pattern}`)
return null return null
} }
+5 -5
View File
@@ -2,11 +2,11 @@ import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import * as semver from 'semver' import * as semver from 'semver'
import {SemVer} from 'semver' import {SemVer} from 'semver'
import {Regex, RegexTransformer, TagResolver} from './types' import {Regex, RegexTransformer, TagResolver} from './types.js'
import {createCommandManager} from './gitHelper' import {createCommandManager} from './gitHelper.js'
import moment from 'moment' import moment from 'moment'
import {transformStringToOptionalValue, transformStringToValue, validateRegex} from './regexUtils' import {transformStringToOptionalValue, transformStringToValue, validateRegex} from './regexUtils.js'
import {BaseRepository} from '../repositories/BaseRepository' import {BaseRepository} from '../repositories/BaseRepository.js'
export interface TagResult { export interface TagResult {
from: TagInfo | null from: TagInfo | null
@@ -67,7 +67,7 @@ export class Tags {
return {name: initialCommit, commit: initialCommit} return {name: initialCommit, commit: initialCommit}
} }
return tags[0] return tags[0]
} catch (error) { } catch {
if (tags.length <= 0) { if (tags.length <= 0) {
core.warning(`⚠️ No tag found for the given repository`) core.warning(`⚠️ No tag found for the given repository`)
} }
+4 -4
View File
@@ -1,13 +1,13 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {RegexTransformer, Rule} from './pr-collector/types' import {RegexTransformer, Rule} from './pr-collector/types.js'
import {PullRequestInfo, retrieveProperty} from './pr-collector/pullRequests' import {PullRequestInfo, retrieveProperty} from './pr-collector/pullRequests.js'
import {validateRegex} from './pr-collector/regexUtils' import {validateRegex} from './pr-collector/regexUtils.js'
/** /**
* Checks if any of the rules match the given PR * Checks if any of the rules match the given PR
*/ */
export function matchesRules(rules: Rule[], pr: PullRequestInfo, exhaustive: boolean): boolean { export function matchesRules(rules: Rule[], pr: PullRequestInfo, exhaustive: boolean): boolean {
const transformers: RegexTransformer[] = rules.map(rule => validateRegex(rule)).filter(t => t !== null) as RegexTransformer[] const transformers: RegexTransformer[] = rules.map(rule => validateRegex(rule)).filter(t => t !== null)
if (exhaustive) { if (exhaustive) {
return transformers.every(transformer => { return transformers.every(transformer => {
return matches(pr, transformer, 'rule') return matches(pr, transformer, 'rule')
+9 -9
View File
@@ -1,13 +1,13 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {Configuration} from './configuration' import {Configuration} from './configuration.js'
import {checkExportedData, writeCacheData} from './utils' import {checkExportedData, writeCacheData} from './utils.js'
import {buildChangelog} from './transform' import {buildChangelog} from './transform.js'
import {PullRequestCollector} from './pr-collector/prCollector' import {PullRequestCollector} from './pr-collector/prCollector.js'
import {failOrError} from './pr-collector/utils' import {failOrError} from './pr-collector/utils.js'
import {TagInfo} from './pr-collector/tags' import {TagInfo} from './pr-collector/tags.js'
import {DiffInfo} from './pr-collector/commits' import {DiffInfo} from './pr-collector/commits.js'
import {PullRequestData, PullRequestInfo} from './pr-collector/pullRequests' import {PullRequestData, PullRequestInfo} from './pr-collector/pullRequests.js'
import {BaseRepository} from './repositories/BaseRepository' import {BaseRepository} from './repositories/BaseRepository.js'
export interface ReleaseNotesOptions { export interface ReleaseNotesOptions {
owner: string // the owner of the repository owner: string // the owner of the repository
+5 -5
View File
@@ -1,9 +1,9 @@
import {TagInfo} from '../pr-collector/tags' import {TagInfo} from '../pr-collector/tags.js'
import {DiffInfo} from '../pr-collector/commits' import {DiffInfo} from '../pr-collector/commits.js'
import moment from 'moment/moment' import {PullRequestInfo} from '../pr-collector/pullRequests.js'
import {PullRequestInfo} from '../pr-collector/pullRequests'
import * as core from '@actions/core' import * as core from '@actions/core'
import {createCommandManager} from '../pr-collector/gitHelper' import {createCommandManager} from '../pr-collector/gitHelper.js'
import moment from 'moment'
export abstract class BaseRepository { export abstract class BaseRepository {
proxy?: string proxy?: string
+5 -5
View File
@@ -1,11 +1,11 @@
import {BaseRepository} from './BaseRepository' import {BaseRepository} from './BaseRepository.js'
import {TagInfo} from '../pr-collector/tags' import {TagInfo} from '../pr-collector/tags.js'
import {CommentInfo, PullRequestInfo} from '../pr-collector/pullRequests' import {CommentInfo, PullRequestInfo} from '../pr-collector/pullRequests.js'
import {DiffInfo} from '../pr-collector/commits' import {DiffInfo} from '../pr-collector/commits.js'
import {Api, PullRequest, PullReview, giteaApi} from 'gitea-js' import {Api, PullRequest, PullReview, giteaApi} from 'gitea-js'
import moment from 'moment' import moment from 'moment'
import * as core from '@actions/core' import * as core from '@actions/core'
import {createCommandManager} from '../pr-collector/gitHelper' import {createCommandManager} from '../pr-collector/gitHelper.js'
interface Pulls { interface Pulls {
closed: PullRequest[] closed: PullRequest[]
+8 -8
View File
@@ -1,12 +1,12 @@
import {BaseRepository} from './BaseRepository' import {BaseRepository} from './BaseRepository.js'
import {Octokit, RestEndpointMethodTypes} from '@octokit/rest' import {Octokit, RestEndpointMethodTypes} from '@octokit/rest'
import {HttpsProxyAgent} from 'https-proxy-agent' import {HttpsProxyAgent} from 'https-proxy-agent'
import * as core from '@actions/core' import * as core from '@actions/core'
import {TagInfo} from '../pr-collector/tags' import {TagInfo} from '../pr-collector/tags.js'
import moment from 'moment/moment' import {DiffInfo} from '../pr-collector/commits.js'
import {DiffInfo} from '../pr-collector/commits' import {CommentInfo, PullData, PullRequestInfo, PullReviewsData, PullsListData} from '../pr-collector/pullRequests.js'
import {CommentInfo, PullData, PullRequestInfo, PullReviewsData, PullsListData} from '../pr-collector/pullRequests' import {Unpacked} from '../pr-collector/utils.js'
import {Unpacked} from '../pr-collector/utils' import moment from 'moment'
export class GithubRepository extends BaseRepository { export class GithubRepository extends BaseRepository {
async getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> { async getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> {
@@ -20,7 +20,7 @@ export class GithubRepository extends BaseRepository {
// This is because the GitHub API limits the number of commits returned in a single response. // This is because the GitHub API limits the number of commits returned in a single response.
let commits: RestEndpointMethodTypes['repos']['compareCommits']['response']['data']['commits'] = [] let commits: RestEndpointMethodTypes['repos']['compareCommits']['response']['data']['commits'] = []
let compareHead = head let compareHead = head
// eslint-disable-next-line no-constant-condition
while (true) { while (true) {
const compareResult = await this.octokit.repos.compareCommits({ const compareResult = await this.octokit.repos.compareCommits({
owner, owner,
@@ -249,7 +249,7 @@ export class GithubRepository extends BaseRepository {
const release: ReleaseInformation = response.data as ReleaseInformation const release: ReleaseInformation = response.data as ReleaseInformation
tagInfo.date = moment(release.created_at) tagInfo.date = moment(release.created_at)
core.info(`️ Retrieved information about the release associated with ${tagInfo.name} from the GitHub API`) core.info(`️ Retrieved information about the release associated with ${tagInfo.name} from the GitHub API`)
} catch (error) { } catch {
tagInfo = await this.getTagByCreateTime(repositoryPath, tagInfo) tagInfo = await this.getTagByCreateTime(repositoryPath, tagInfo)
} }
return tagInfo return tagInfo
+11 -23
View File
@@ -1,6 +1,6 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {Category, Configuration, Placeholder, PlaceholderGroup, Property} from './configuration' import {Category, Configuration, Placeholder, PlaceholderGroup, Property} from './configuration.js'
import {createOrSet, groupPlaceholders, haveCommonElementsArr, haveEveryElementsArr, mergeMaps} from './utils' import {createOrSet, groupPlaceholders, haveCommonElementsArr, haveEveryElementsArr, mergeMaps} from './utils.js'
import { import {
CommentInfo, CommentInfo,
EMPTY_COMMENT_INFO, EMPTY_COMMENT_INFO,
@@ -9,12 +9,12 @@ import {
PullRequestInfo, PullRequestInfo,
retrieveProperty, retrieveProperty,
sortPullRequests sortPullRequests
} from './pr-collector/pullRequests' } from './pr-collector/pullRequests.js'
import {DiffInfo} from './pr-collector/commits' import {DiffInfo} from './pr-collector/commits.js'
import {transformStringToOptionalValue, transformStringToValues, validateRegex} from './pr-collector/regexUtils' import {transformStringToOptionalValue, transformStringToValues, validateRegex} from './pr-collector/regexUtils.js'
import {ChangelogStrings, GroupedTemplateContext, PrStrings, Regex, RegexTransformer, TemplateContext} from './pr-collector/types' import {ChangelogStrings, GroupedTemplateContext, PrStrings, Regex, RegexTransformer, TemplateContext} from './pr-collector/types.js'
import {ReleaseNotesOptions} from './releaseNotesBuilder' import {ReleaseNotesOptions} from './releaseNotesBuilder.js'
import {matchesRules} from './regexUtils' import {matchesRules} from './regexUtils.js'
let CLEAR = false let CLEAR = false
@@ -315,14 +315,12 @@ function buildPrStringsAndFillCategoryEntries(
} }
} }
const prStrings: PrStrings = { return {
categorizedList: categorizedPrs, categorizedList: categorizedPrs,
uncategorizedList: uncategorizedPrs, uncategorizedList: uncategorizedPrs,
openList: openPrs, openList: openPrs,
ignoredList: ignoredPrs ignoredList: ignoredPrs
} }
return prStrings
} }
function buildChangelogStrings(flatCategories: Category[], prStrings: PrStrings): ChangelogStrings { function buildChangelogStrings(flatCategories: Category[], prStrings: PrStrings): ChangelogStrings {
@@ -371,14 +369,12 @@ function buildChangelogStrings(flatCategories: Category[], prStrings: PrStrings)
} }
} }
const changelogStrings: ChangelogStrings = { return {
categorized: changelogCategorized, categorized: changelogCategorized,
uncategorized: changelogUncategorized, uncategorized: changelogUncategorized,
open: changelogOpen, open: changelogOpen,
ignored: changelogIgnored ignored: changelogIgnored
} }
return changelogStrings
} }
function buildReleaseNotesTemplateContext( function buildReleaseNotesTemplateContext(
@@ -550,15 +546,7 @@ export function renderEmptyChangelogTemplate(template: string, options: ReleaseN
const releaseNotesTemplateContext = buildCoreReleaseNotesTemplateContext(options) const releaseNotesTemplateContext = buildCoreReleaseNotesTemplateContext(options)
const renderedEmptyChangelogTemplate = renderTemplateAndFillPlaceholderContext( return renderTemplateAndFillPlaceholderContext(template, releaseNotesTemplateContext, placeholders, undefined, options.configuration)
template,
releaseNotesTemplateContext,
placeholders,
undefined,
options.configuration
)
return renderedEmptyChangelogTemplate
} }
function buildCoreReleaseNotesTemplateContext(options: ReleaseNotesOptions): TemplateContext { function buildCoreReleaseNotesTemplateContext(options: ReleaseNotesOptions): TemplateContext {
+7 -7
View File
@@ -1,11 +1,11 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import {Configuration, DefaultCommitConfiguration, DefaultConfiguration, Placeholder} from './configuration' import {Configuration, DefaultCommitConfiguration, DefaultConfiguration, Placeholder} from './configuration.js'
import moment from 'moment' import moment from 'moment'
import {DiffInfo} from './pr-collector/commits' import {DiffInfo} from './pr-collector/commits.js'
import {PullRequestInfo} from './pr-collector/pullRequests' import {PullRequestInfo} from './pr-collector/pullRequests.js'
import {Data, ReleaseNotesOptions} from './releaseNotesBuilder' import {Data, ReleaseNotesOptions} from './releaseNotesBuilder.js'
import {env} from 'process' import {env} from 'process'
/** /**
@@ -118,7 +118,7 @@ export function checkExportedData(exportCache: boolean, cacheInput: string | nul
} }
export function resolveMode(mode: string | undefined, commitMode: boolean): 'PR' | 'COMMIT' | 'HYBRID' { export function resolveMode(mode: string | undefined, commitMode: boolean): 'PR' | 'COMMIT' | 'HYBRID' {
if (commitMode === true) { if (commitMode) {
return 'COMMIT' return 'COMMIT'
} }
@@ -179,10 +179,10 @@ function readConfiguration(filename: string): Configuration | undefined {
export function parseConfiguration(config: string): Configuration | undefined { export function parseConfiguration(config: string): Configuration | undefined {
try { try {
// for compatibility with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here. // for compatibility with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here.
const configurationJSON: Configuration = JSON.parse(config.replace(/\${{/g, '#{{')) return JSON.parse(config.replace(/\${{/g, '#{{'))
return configurationJSON
} catch (error) { } catch (error) {
core.info(`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`) core.info(`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`)
core.debug(`Error parsing configuration: ${error}`)
return undefined return undefined
} }
} }
+6 -3
View File
@@ -1,13 +1,16 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "module": "NodeNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */ "outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */ "strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictPropertyInitialization": true,
"noImplicitThis": true,
"moduleResolution": "Node16",
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"lib": [ "ES2021.String", "dom"] /* Enable custom `ES2021.String` extension in typescript for `replaceAll` */ "lib": [ "ESNext","ES2021.String", "dom"] /* Enable custom `ES2021.String` extension in typescript for `replaceAll` */
}, },
"exclude": ["node_modules", "__tests__/*.ts", "**/*.test.ts", "**/**/*.test.ts"], "exclude": ["node_modules", "__tests__/*.ts", "**/*.test.ts", "**/**/*.test.ts"],
} }