Skip to content

Commit e676802

Browse files
authored
Merge pull request #256 from issue-ops/ncalteen/api-url
Add api_url as input
2 parents f8e4955 + db9d1c1 commit e676802

File tree

7 files changed

+18
-5
lines changed

7 files changed

+18
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ jobs:
134134
135135
| Input | Description |
136136
| ------------------------ | ----------------------------------------------------------------------------------------- |
137+
| `api_url` | The GitHub API URL to use |
138+
| | Default: `${{ github.api_url }}` |
137139
| `draft` | Whether or not the release should be a draft |
138140
| | Default: `false` |
139141
| `generate_release_notes` | Whether or not to generate release notes |

__tests__/main.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('main.ts', () => {
2525
beforeEach(() => {
2626
// Set the action's inputs as return values from core.getInput()
2727
core.getInput
28+
.mockReturnValueOnce('https://api.github.com') // api_url
2829
.mockReturnValueOnce('false') // draft
2930
.mockReturnValueOnce('true') // generate_release_notes
3031
.mockReturnValueOnce('v1.0.0') // name
@@ -52,6 +53,7 @@ describe('main.ts', () => {
5253

5354
await main.run()
5455

56+
expect(core.getInput).toHaveBeenCalledWith('api_url', { required: true })
5557
expect(core.getInput).toHaveBeenCalledWith('draft')
5658
expect(core.getInput).toHaveBeenCalledWith('generate_release_notes')
5759
expect(core.getInput).toHaveBeenCalledWith('name')
@@ -75,6 +77,7 @@ describe('main.ts', () => {
7577
it('Replaces name with tag when not present', async () => {
7678
core.getInput
7779
.mockClear()
80+
.mockReturnValueOnce('https://api.gihub.com') // api_url
7881
.mockReturnValueOnce('false') // draft
7982
.mockReturnValueOnce('true') // generate_release_notes
8083
.mockReturnValueOnce('') // name

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ branding:
77
color: blue
88

99
inputs:
10+
api_url:
11+
description: The GitHub API URL to use.
12+
required: false
13+
default: ${{ github.api_url }}
1014
draft:
1115
description: Whether or not the release should be a draft.
1216
required: false

dist/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "releaser",
33
"description": "Handle releases for GitHub repositories",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"type": "module",
66
"author": "Nick Alteen <[email protected]>",
77
"homepage": "https://github.com/issue-ops/releaser#readme",

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { CreateReleaseOptions, Release } from './interfaces.js'
44

55
export async function run(): Promise<void> {
66
// Get the inputs
7+
const apiUrl = core.getInput('api_url', { required: true })
78
const draft: boolean = core.getInput('draft') === 'true'
89
const generateReleaseNotes: boolean =
910
core.getInput('generate_release_notes') === 'true'
@@ -23,6 +24,7 @@ export async function run(): Promise<void> {
2324

2425
// Log the inputs
2526
core.info('Running action with the following inputs:')
27+
core.info(` apiUrl: ${apiUrl}`)
2628
core.info(` draft: ${draft}`)
2729
core.info(` generateReleaseNotes: ${generateReleaseNotes}`)
2830
core.info(` name: ${name}`)
@@ -34,7 +36,7 @@ export async function run(): Promise<void> {
3436
core.info(` target: ${target}`)
3537

3638
// Create the Octokit client
37-
const github: Octokit = new Octokit({ auth: token })
39+
const github: Octokit = new Octokit({ auth: token, baseUrl: apiUrl })
3840

3941
try {
4042
// Create the API options

0 commit comments

Comments
 (0)