Adding baseUrl for GHE auth
This commit is contained in:
@@ -78,6 +78,24 @@ jobs:
|
||||
CHANGELOG: ${{ steps.complex_release.outputs.changelog }}
|
||||
run: echo "CHANGELOG"
|
||||
|
||||
# Showcases a more complex configuration, providing a configuration, and specifically referencing owner, repo, from, to tag and base URL
|
||||
- name: "Complex Configuration with base URL"
|
||||
id: complex_release_baseurl
|
||||
uses: ./
|
||||
with:
|
||||
configuration: "configs/configuration_complex.json"
|
||||
owner: "mikepenz"
|
||||
repo: "release-changelog-builder-action"
|
||||
fromTag: "v0.0.1"
|
||||
toTag: "v0.0.3"
|
||||
baseUrl: "https://corp.globant.com/api/v3"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Echo Complex Configuration With baseUrl Changelog
|
||||
env:
|
||||
CHANGELOG: ${{ steps.complex_release_baseurl.outputs.changelog }}
|
||||
run: echo "CHANGELOG"
|
||||
|
||||
# Showcases the capability to generate the changelog for an external repository provided
|
||||
- name: "External Repo Configuration"
|
||||
id: external_changelog
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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',
|
||||
@@ -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',
|
||||
@@ -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',
|
||||
@@ -76,6 +79,7 @@ it('Should fill empty placeholders', async () => {
|
||||
'configs_test/configuration_empty_all_placeholders.json'
|
||||
)
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null,
|
||||
null,
|
||||
'.',
|
||||
'mikepenz',
|
||||
@@ -101,6 +105,7 @@ it('Should fill `template` placeholders', async () => {
|
||||
'configs_test/configuration_empty_all_placeholders.json'
|
||||
)
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null,
|
||||
null,
|
||||
'.',
|
||||
'mikepenz',
|
||||
@@ -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',
|
||||
@@ -151,6 +157,7 @@ it('Uncategorized category', async () => {
|
||||
'configs_test/configuration_uncategorized_category.json'
|
||||
)
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null,
|
||||
null,
|
||||
'.',
|
||||
'mikepenz',
|
||||
@@ -176,6 +183,7 @@ it('Verify commit based changelog', async () => {
|
||||
'configs_test/configuration_commits.json'
|
||||
)
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null,
|
||||
null,
|
||||
'.',
|
||||
'mikepenz',
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
+6
-3
@@ -357,6 +357,7 @@ function run() {
|
||||
const configurationFile = core.getInput('configuration');
|
||||
const configuration = (0, utils_1.resolveConfiguration)(repositoryPath, configurationFile);
|
||||
// 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;
|
||||
@@ -367,7 +368,7 @@ function run() {
|
||||
const ignorePreReleases = core.getInput('ignorePreReleases') === 'true';
|
||||
const failOnError = core.getInput('failOnError') === 'true';
|
||||
const commitMode = core.getInput('commitMode') === 'true';
|
||||
const result = yield new releaseNotesBuilder_1.ReleaseNotesBuilder(token, repositoryPath, owner, repo, fromTag, toTag, failOnError, ignorePreReleases, commitMode, configuration).build();
|
||||
const result = yield new releaseNotesBuilder_1.ReleaseNotesBuilder(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, failOnError, ignorePreReleases, commitMode, configuration).build();
|
||||
core.setOutput('changelog', result);
|
||||
// write the result in changelog to file if possible
|
||||
const outputFile = core.getInput('outputFile');
|
||||
@@ -765,7 +766,8 @@ const tags_1 = __nccwpck_require__(7532);
|
||||
const utils_1 = __nccwpck_require__(918);
|
||||
const transform_1 = __nccwpck_require__(1644);
|
||||
class ReleaseNotesBuilder {
|
||||
constructor(token, repositoryPath, owner, repo, fromTag, toTag, failOnError, ignorePreReleases, commitMode, configuration) {
|
||||
constructor(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, failOnError, ignorePreReleases, commitMode, configuration) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.token = token;
|
||||
this.repositoryPath = repositoryPath;
|
||||
this.owner = owner;
|
||||
@@ -799,7 +801,8 @@ class ReleaseNotesBuilder {
|
||||
core.endGroup();
|
||||
// load octokit instance
|
||||
const octokit = new rest_1.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
|
||||
core.startGroup(`🔖 Resolve tags`);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+9
-6804
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -36,6 +37,7 @@ async function run(): Promise<void> {
|
||||
const commitMode = core.getInput('commitMode') === 'true'
|
||||
|
||||
const result = await new ReleaseNotesBuilder(
|
||||
baseUrl,
|
||||
token,
|
||||
repositoryPath,
|
||||
owner,
|
||||
|
||||
@@ -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,
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user