Skip to content

Commit 6a6a21c

Browse files
committed
Alphebetize inputs
1 parent 5dcb892 commit 6a6a21c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

__tests__/main.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ describe('Invalid Usage', () => {
2626
// Set the action's inputs as return values from core.getInput()
2727
core.getInput
2828
.mockReturnValueOnce('noop') // action
29+
.mockReturnValueOnce('') // api_url
2930
.mockReturnValueOnce('nahhhh') // create
3031
.mockReturnValueOnce('token') // github_token
3132
.mockReturnValueOnce([].join('\n')) // labels
3233
.mockReturnValueOnce('MyAwesomeIssue') // issue_number
3334
.mockReturnValueOnce('issue-ops/invalid-repo') // repository
34-
.mockReturnValueOnce('') // api_url
3535
})
3636

3737
afterEach(() => {
@@ -41,12 +41,12 @@ describe('Invalid Usage', () => {
4141
it('Fails on invalid action input', async () => {
4242
core.getInput
4343
.mockReturnValueOnce('noop') // action
44+
.mockReturnValueOnce('') // api_url
4445
.mockReturnValueOnce('nahhhh') // create
4546
.mockReturnValueOnce('token') // github_token
4647
.mockReturnValueOnce([].join('\n')) // labels
4748
.mockReturnValueOnce('MyAwesomeIssue') // issue_number
4849
.mockReturnValueOnce('issue-ops/invalid-repo') // repository
49-
.mockReturnValueOnce('') // api_url
5050

5151
await main.run()
5252

@@ -63,12 +63,12 @@ describe('Input Validation', () => {
6363
it('Handles invalid issue number', async () => {
6464
core.getInput
6565
.mockReturnValueOnce('add') // action
66+
.mockReturnValueOnce('') // api_url
6667
.mockReturnValueOnce('false') // create
6768
.mockReturnValueOnce('token') // github_token
6869
.mockReturnValueOnce(['test'].join('\n')) // labels
6970
.mockReturnValueOnce('not-a-number') // issue_number
7071
.mockReturnValueOnce('issue-ops/labeler') // repository
71-
.mockReturnValueOnce('') // api_url
7272

7373
await main.run()
7474

@@ -82,12 +82,12 @@ describe('Add Labels', () => {
8282
// Set the action's inputs as return values from core.getInput()
8383
core.getInput
8484
.mockReturnValueOnce('add') // action
85+
.mockReturnValueOnce('') // api_url
8586
.mockReturnValueOnce('true') // create
8687
.mockReturnValueOnce('token') // github_token
8788
.mockReturnValueOnce(['bug', 'enhancement'].join('\n')) // labels
8889
.mockReturnValueOnce('1') // issue_number
8990
.mockReturnValueOnce('issue-ops/labeler') // repository
90-
.mockReturnValueOnce('') // api_url
9191
})
9292

9393
afterEach(() => {
@@ -123,12 +123,12 @@ describe('Add Labels', () => {
123123

124124
core.getInput
125125
.mockReturnValueOnce('add') // action
126+
.mockReturnValueOnce('https://github.enterprise.com/api/v3') // api_url
126127
.mockReturnValueOnce('true') // create
127128
.mockReturnValueOnce('token') // github_token
128129
.mockReturnValueOnce(['bug'].join('\n')) // labels
129130
.mockReturnValueOnce('1') // issue_number
130131
.mockReturnValueOnce('issue-ops/labeler') // repository
131-
.mockReturnValueOnce('https://github.enterprise.com/api/v3') // api_url
132132

133133
await main.run()
134134

@@ -185,12 +185,12 @@ describe('Add Labels', () => {
185185

186186
core.getInput
187187
.mockReturnValueOnce('add') // action
188+
.mockReturnValueOnce('') // api_url
188189
.mockReturnValueOnce('false') // create
189190
.mockReturnValueOnce('token') // github_token
190191
.mockReturnValueOnce(['nonexistent-label'].join('\n')) // labels
191192
.mockReturnValueOnce('1') // issue_number
192193
.mockReturnValueOnce('issue-ops/labeler') // repository
193-
.mockReturnValueOnce('') // api_url
194194

195195
mocktokit.rest.issues.getLabel.mockRejectedValue({
196196
status: 404,
@@ -214,12 +214,12 @@ describe('Remove Labels', () => {
214214
// Set the action's inputs as return values from core.getInput()
215215
core.getInput
216216
.mockReturnValueOnce('remove') // action
217+
.mockReturnValueOnce('') // api_url
217218
.mockReturnValueOnce('true') // create
218219
.mockReturnValueOnce('token') // github_token
219220
.mockReturnValueOnce(['bug', 'enhancement'].join('\n')) // labels
220221
.mockReturnValueOnce('1') // issue_number
221222
.mockReturnValueOnce('issue-ops/labeler') // repository
222-
.mockReturnValueOnce('') // api_url
223223
})
224224

225225
afterEach(() => {

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
description: The action to take
1212
required: false
1313
default: add
14+
api_url:
15+
description: The GitHub API URL to use
16+
required: false
17+
default: ${{ github.api_url }}
1418
create:
1519
description: Create the label(s) if not present
1620
required: false
@@ -31,10 +35,6 @@ inputs:
3135
description: The repository to use
3236
required: false
3337
default: ${{ github.repository }}
34-
api_url:
35-
description: The GitHub API URL to use
36-
required: false
37-
default: ${{ github.api_url }}
3838

3939
runs:
4040
using: node20

dist/index.js

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

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Octokit } from '@octokit/rest'
77
export async function run(): Promise<void> {
88
// Get inputs
99
const action: string = core.getInput('action', { required: true })
10+
const apiUrl: string = core.getInput('api_url', { required: true })
1011
const create: boolean = core.getInput('create') === 'true'
1112
const githubToken: string = core.getInput('github_token', { required: true })
1213
const labels: string[] = core
@@ -19,15 +20,14 @@ export async function run(): Promise<void> {
1920
const repository: string = core.getInput('repository', {
2021
required: true
2122
})
22-
const apiUrl: string = core.getInput('api_url', { required: true })
2323

2424
core.info('Running action with the following inputs:')
2525
core.info(` - Action: ${action}`)
26+
core.info(` - API URL: ${apiUrl}`)
2627
core.info(` - Create: ${create}`)
2728
core.info(` - Issue Number: ${issueNumber}`)
2829
core.info(` - Labels: ${labels.join(', ')}`)
2930
core.info(` - Repository: ${repository}`)
30-
core.info(` - API URL: ${apiUrl}`)
3131

3232
// Verify action is `add` or `remove`
3333
if (!['add', 'remove'].includes(action))

0 commit comments

Comments
 (0)