Skip to content

Commit

Permalink
Merge branch 'leog-develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Dec 4, 2021
2 parents 8178b36 + 1f50189 commit 01b8841
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ For advanced use cases additional settings can be provided to the action
| `toTag` | Defines until which tag the changelog will consider merged pull requests |
| `path` | Allows to specify an alternative sub directory, to use as base |
| `token` | Alternative config to specify token. You should prefer `env.GITHUB_TOKEN` instead though |
| `baseUrl` | Alternative config to specify base url for GitHub Enterprise authentication. Default value set to `https://api.github.com` |
| `ignorePreReleases` | Allows to ignore pre-releases for changelog generation (E.g. for 1.0.1... 1.0.0-rc02 <- ignore, 1.0.0 <- pick). Only used if `fromTag` was not specified. Default: false |
| `failOnError` | Defines if the action will result in a build failure if problems occurred. Default: false |
| `commitMode` | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. Default: false |
Expand Down
9 changes: 9 additions & 0 deletions __tests__/releaseNotesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jest.setTimeout(180000)
it('Should match generated changelog (unspecified fromTag)', async () => {
const configuration = resolveConfiguration('', 'configs/configuration.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -31,6 +32,7 @@ it('Should match generated changelog (unspecified fromTag)', async () => {
it('Should match generated changelog (unspecified tags)', async () => {
const configuration = resolveConfiguration('', 'configs/configuration.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -53,6 +55,7 @@ it('Should match generated changelog (unspecified tags)', async () => {
it('Should use empty placeholder', async () => {
const configuration = resolveConfiguration('', 'configs/configuration.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -76,6 +79,7 @@ it('Should fill empty placeholders', async () => {
'configs_test/configuration_empty_all_placeholders.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -101,6 +105,7 @@ it('Should fill `template` placeholders', async () => {
'configs_test/configuration_empty_all_placeholders.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -126,6 +131,7 @@ it('Should fill `template` placeholders, ignore', async () => {
'configs_test/configuration_empty_all_placeholders.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -151,6 +157,7 @@ it('Uncategorized category', async () => {
'configs_test/configuration_uncategorized_category.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -176,6 +183,7 @@ it('Verify commit based changelog', async () => {
'configs_test/configuration_commits.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'mikepenz',
Expand All @@ -201,6 +209,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
'configs_test/configuration_commits_emoji.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
'.',
'theapache64',
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ inputs:
description: 'If defined, the changelog will get written to this file. (relative to the checkout dir)'
token:
description: 'Defines the token to use to execute the git API requests with, uses `env.GITHUB_TOKEN` by default'
baseUrl:
description: 'Defines the base url for GitHub Enterprise authentication, uses `https://api.github.com` by default'
outputs:
changelog:
description: The built release changelog built from the merged pull requests
Expand Down
9 changes: 6 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async function run(): Promise<void> {
)

// read in repository inputs
const baseUrl = core.getInput('baseUrl')
const token = core.getInput('token')
const owner = core.getInput('owner') || github.context.repo.owner
const repo = core.getInput('repo') || github.context.repo.repo
Expand All @@ -36,6 +37,7 @@ async function run(): Promise<void> {
const commitMode = core.getInput('commitMode') === 'true'

const result = await new ReleaseNotesBuilder(
baseUrl,
token,
repositoryPath,
owner,
Expand Down
4 changes: 3 additions & 1 deletion src/releaseNotesBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {fillAdditionalPlaceholders} from './transform'

export class ReleaseNotesBuilder {
constructor(
private baseUrl: string | null,
private token: string | null,
private repositoryPath: string,
private owner: string | null,
Expand Down Expand Up @@ -40,7 +41,8 @@ export class ReleaseNotesBuilder {

// load octokit instance
const octokit = new Octokit({
auth: `token ${this.token || process.env.GITHUB_TOKEN}`
auth: `token ${this.token || process.env.GITHUB_TOKEN}`,
baseUrl: `${this.baseUrl || "https://api.github.com"}`
})

// ensure proper from <-> to tag range
Expand Down

0 comments on commit 01b8841

Please sign in to comment.