Merge pull request #487 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2021-09-14 13:58:38 +02:00
committed by GitHub
10 changed files with 866 additions and 762 deletions
+71
View File
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '41 22 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# 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)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
+1 -1
View File
@@ -311,7 +311,7 @@ it('Deduplicate duplicated PRs', async () => {
})
expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n- [ABC-4321] - this is a PR 2 title message\n - PR: #2\n\n`
`## 🚀 Features\n\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [ABC-4321] - this is a PR 2 title message\n - PR: #2\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n`
)
})
Generated Vendored
+32 -14
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+730 -726
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -35,25 +35,25 @@
"@actions/core": "^1.5.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@octokit/rest": "^18.9.1",
"@octokit/rest": "^18.10.0",
"@types/semver": "^7.3.8",
"moment": "^2.29.1",
"semver": "^7.3.5",
"webpack": "^5.51.1"
"webpack": "^5.52.1"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@types/node": "^16.7.2",
"@typescript-eslint/parser": "^4.29.3",
"@vercel/ncc": "^0.29.2",
"@types/node": "^16.9.1",
"@typescript-eslint/parser": "^4.31.1",
"@vercel/ncc": "^0.31.1",
"eslint": "^7.32.0",
"eslint-plugin-github": "^4.2.0",
"eslint-plugin-github": "^4.3.0",
"eslint-plugin-jest": "^24.4.0",
"jest": "^27.0.6",
"jest-circus": "^27.0.6",
"jest": "^27.2.0",
"jest-circus": "^27.2.0",
"js-yaml": "^4.1.0",
"prettier": "2.3.2",
"prettier": "2.4.0",
"ts-jest": "^27.0.5",
"typescript": "^4.4.2"
"typescript": "^4.4.3"
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ const mapPullRequest = (
author: pr.user?.login || '',
repoName: pr.base.repo.full_name,
labels: new Set(
pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase() || '') || []
pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase('en') || '') || []
),
milestone: pr.milestone?.title || '',
body: pr.body || '',
+3 -1
View File
@@ -67,7 +67,9 @@ export class Tags {
const length = tags.length
if (tags.length > 1) {
for (let i = 0; i < length; i++) {
if (tags[i].name.toLocaleLowerCase() === tag.toLocaleLowerCase()) {
if (
tags[i].name.toLocaleLowerCase('en') === tag.toLocaleLowerCase('en')
) {
if (ignorePreReleases) {
core.info(
`️ Enabled 'ignorePreReleases', searching for the closest release`
+11 -8
View File
@@ -26,22 +26,25 @@ export function buildChangelog(
core.info(`️ Remove duplicated pull requests using \`duplicate_filter\``)
const deduplicatedMap = new Map<string, PullRequestInfo>()
const unmatched: PullRequestInfo[] = []
for (const pr of prs) {
const extracted = extractValues(pr, extractor, 'dupliate_filter')
if (extracted !== null && extracted.length > 0) {
deduplicatedMap.set(extracted[0], pr)
} else {
core.debug(
` PR (${pr.number}) did not resolve a ID using the \`duplicate_filter\``
core.info(
` PR (${pr.number}) did not resolve an ID using the \`duplicate_filter\``
)
unmatched.push(pr)
}
}
const deduplicatedPRs = Array.from(deduplicatedMap.values())
deduplicatedPRs.push(...unmatched) // add all unmatched PRs to map
const removedElements = prs.length - deduplicatedPRs.length
core.info(
`️ Removed ${removedElements} pull requests during deduplication`
)
prs = deduplicatedPRs
prs = sortPullRequests(deduplicatedPRs, sortAsc) // resort deduplicatedPRs
} else {
core.warning(`⚠️ Configured \`duplicate_filter\` invalid.`)
}
@@ -98,7 +101,7 @@ export function buildChangelog(
for (const [pr, body] of transformedMap) {
if (
haveCommonElements(
ignoredLabels.map(lbl => lbl.toLocaleLowerCase()),
ignoredLabels.map(lbl => lbl.toLocaleLowerCase('en')),
pr.labels
)
) {
@@ -111,7 +114,7 @@ export function buildChangelog(
if (category.exhaustive === true) {
if (
haveEveryElements(
category.labels.map(lbl => lbl.toLocaleLowerCase()),
category.labels.map(lbl => lbl.toLocaleLowerCase('en')),
pr.labels
)
) {
@@ -121,7 +124,7 @@ export function buildChangelog(
} else {
if (
haveCommonElements(
category.labels.map(lbl => lbl.toLocaleLowerCase()),
category.labels.map(lbl => lbl.toLocaleLowerCase('en')),
pr.labels
)
) {
@@ -344,12 +347,12 @@ function extractValues(
if (extractor.method === 'match') {
const lables = onValue.match(extractor.pattern)
if (lables !== null) {
return lables.map(label => label.toLocaleLowerCase())
return lables.map(label => label.toLocaleLowerCase('en'))
}
} else {
const label = onValue.replace(extractor.pattern, extractor.target)
if (label !== '') {
return [label.toLocaleLowerCase()]
return [label.toLocaleLowerCase('en')]
}
}
return null
+6
View File
@@ -53,7 +53,13 @@ export function resolveConfiguration(
const providedConfiguration = readConfiguration(configurationPath)
if (providedConfiguration) {
configuration = providedConfiguration
core.info(`️ Configuration successfully loaded.`)
if (core.isDebug()) {
core.debug(`configuration = ${JSON.stringify(configuration)}`)
}
}
} else {
core.info(`️ Configuration not provided. Using Defaults.`)
}
return configuration
}