Skip to content

Commit

Permalink
Merge pull request #1390 from mikepenz/develop
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
mikepenz authored Nov 2, 2024
2 parents 346d974 + ac686fc commit 5e4dd63
Show file tree
Hide file tree
Showing 20 changed files with 2,433 additions and 2,853 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'CI'
name: "CI"
on:
push:
tags:
- '*'
- "*"
pull_request:

concurrency:
Expand All @@ -25,13 +25,13 @@ jobs:
- name: Install NPM
run: |
npm install
- name: Run NPM
run: |
npm run all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Echo Configuration without Checkout Changelog
env:
CHANGELOG: ${{ steps.without_checkout.outputs.changelog }}
Expand All @@ -89,7 +89,7 @@ jobs:
uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Echo Minimal Configuration Changelog
env:
CHANGELOG: ${{ steps.minimal_release.outputs.changelog }}
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
token: ${{ secrets.PERSONAL_TOKEN }}
exportCache: true
exportOnly: true

- name: "External Repo Configuration"
id: external_changelog
uses: ./
Expand Down Expand Up @@ -188,4 +188,3 @@ jobs:
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-b') || contains(github.ref, '-a') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ __tests__/runner/*
lib/**/*

lib
src/pr-collector/dist
src/pr-collector/dist
.idea
10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
"arrowParens": "avoid",
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"options": {
"singleQuote": false
}
}
]
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ Specify the action as part of your GitHub actions workflow:
uses: mikepenz/release-changelog-builder-action@{latest-release}
```
> [!IMPORTANT]
> When upgrading from v4 to v5, please ensure to read the upgrade warning in the [release notes](https://github.com/mikepenz/release-changelog-builder-action/releases), especially if [regexes](https://github.com/mikepenz/release-changelog-builder-action?tab=readme-ov-file#regex-configuration) are used.
## Full Sample 🖥️
Below is a complete example showcasing how to define a build, which is executed when tagging the project. It consists of:
- Prepare tag, via the GITHUB_REF environment variable
- Build changelog, given the tag
- Create a release on GitHub - specifying body with a constructed changelog
> [!NOTE]
> Pre v4 PRs will only show up in the changelog if assigned one of the default label categories "feature", "fix" or "test". Starting with v4 these PRs will be in the `Uncategorized` section.

<details><summary><b>Example</b></summary>
<p>
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
"target": "$1"
}
],
]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -279,7 +279,7 @@ A full set list of possible output values for this action.
> 2. Create an initial tag on the commit you want to begin a changelog from (for example `v0.0.1`).

> [!NOTE]
> By default not specifying `fromTag` or `toTag` will resolve `toTag` from either the `ref` or alternatively fallback to the latest tag from the git API. `fromTag` is resolved by sorting tags using [semver](https://semver.org/). Check the [configuration](#configuration-specification) for alternatives.
> By default not specifying `fromTag` or `toTag` will resolve `toTag` from either the `ref` or alternatively fallback to the latest tag from the git API. `fromTag` is resolved by sorting tags using [semver](https://semver.org/). Tags not following semver are filtered out. Check the [configuration](#configuration-specification) for alternatives.

> [!NOTE]
> If you are behind a corporate HTTP proxy, you can set the `https_proxy` environment variable to the proxy URL. For reference, please see the Octokit [documentation](https://github.com/octokit/octokit.js/#proxy-servers-nodejs-only).
Expand Down Expand Up @@ -577,7 +577,7 @@ This applies to all configurations outlined in `Configuration Specification` and
| <parent>.method | The extraction method used. Defaults to: `replace`. Alternative values: `replaceAll`, `match`. These methods specified references the JavaScript String method. And a special method `regexr`, that functions similar to the `list` within the regexr tool. |
| <parent>.flags | Defines the regex flags specified for the pattern. Default: `gu`. |
| <parent>.on_empty | Defines the placeholder to be filled in, if the regex does not lead to a result. |
| <parent>.on_property | This is available for `Extractor` type regex objects. With the property describing a field available in PRs. (e.g.: title, body, ...) |
| <parent>.on_property | This is available for `Extractor` type regex objects. With the property describing a field available in PRs. (e.g.: title, body, ...) Default: `body`. |

<details><summary><b>Example regex configuration block</b></summary>
<p>
Expand Down
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('missing values should result in failure', () => {
}
try {
cp.execSync(`node ${ip}`, options).toString()
} catch (error: any) {
} catch (error: unknown) {
expect(true).toBe(true)
}
})
Expand Down
4 changes: 2 additions & 2 deletions __tests__/releaseNotesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ it('[Github] Uncategorized category', async () => {
})

it('[Github] Verify commit based changelog', async () => {
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits.json'))
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits.json'), 'COMMIT')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
githubRepository,
Expand Down Expand Up @@ -257,7 +257,7 @@ it('[Github] Verify commit based changelog', async () => {
})

it('[Github] Verify commit based changelog, with emoji categorisation', async () => {
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits_emoji.json'))
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_commits_emoji.json'), 'COMMIT')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
githubRepository,
Expand Down
4 changes: 3 additions & 1 deletion __tests__/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ it('Extract label from title, split regex', async () => {
on_property: 'title'
}
]

expect(buildChangelogTest(configuration, mergedPullRequests, repositoryUtils)).toStrictEqual(
`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`
)
Expand Down Expand Up @@ -448,7 +449,8 @@ it('Use empty_content for empty category', async () => {
labels: ['Feature']
}
]
expect(buildChangelogTest(customConfig, pullRequestsWithLabels, repositoryUtils)).toStrictEqual(
const changelog = buildChangelogTest(customConfig, pullRequestsWithLabels, repositoryUtils)
expect(changelog).toStrictEqual(
`## 🚀 Features and 🐛 Issues\n\n- No PRs in this category\n\n## 🚀 Features\n\n- [ABC-1234] - this is a PR 1 title message\n - PR: #1\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n`
)
})
Expand Down
Loading

0 comments on commit 5e4dd63

Please sign in to comment.