Skip to content

Commit 01962f0

Browse files
committed
chore: add tags argument
1 parent e374424 commit 01962f0

File tree

6 files changed

+36
-5
lines changed

6 files changed

+36
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
# dry-run: true
3131
hey-api-token: ${{ secrets.HEY_API_TOKEN }}
3232
path-to-openapi: ./openapi.json
33+
tags: dev
3334

3435
- name: Upload YAML OpenAPI spec
3536
id: upload-yaml-openapi-spec
@@ -39,3 +40,4 @@ jobs:
3940
# dry-run: true
4041
hey-api-token: ${{ secrets.HEY_API_TOKEN }}
4142
path-to-openapi: ./openapi.yaml
43+
tags: dev

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
path-to-openapi:
1717
description: Input path to your OpenAPI specification file
1818
required: true
19+
tags:
20+
description: Custom specification tags
21+
required: false
1922
name: Upload OpenAPI spec by Hey API 👋
2023
runs:
2124
main: dist/index.js

dist/index.js

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

dist/index.js.map

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

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@ export async function run(): Promise<void> {
2020
const pathToOpenApi: string = core.getInput('path-to-openapi', {
2121
required: true
2222
})
23+
const tags: string = core.getInput('tags', {
24+
required: false
25+
})
2326

2427
core.debug(`Path to OpenAPI: ${pathToOpenApi}`)
2528
core.debug(`Upload started: ${new Date().toTimeString()}`)
2629
await upload({
2730
baseUrl,
2831
dryRun,
2932
heyApiToken,
30-
pathToOpenApi
33+
pathToOpenApi,
34+
tags
3135
})
3236
core.debug(`Upload completed: ${new Date().toTimeString()}`)
3337
} catch (error) {

src/upload.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ export async function upload({
88
baseUrl = 'https://platform-production-25fb.up.railway.app',
99
dryRun,
1010
heyApiToken,
11-
pathToOpenApi
11+
pathToOpenApi,
12+
tags
1213
}: {
14+
/**
15+
* Custom service url.
16+
*/
1317
baseUrl?: string
18+
/**
19+
* Return mock response?
20+
*/
1421
dryRun?: boolean
1522
/**
1623
* Hey API token.
@@ -20,6 +27,10 @@ export async function upload({
2027
* Path to the OpenAPI specification file.
2128
*/
2229
pathToOpenApi: string
30+
/**
31+
* Custom specification tags.
32+
*/
33+
tags?: string
2334
}): Promise<void> {
2435
if (!pathToOpenApi) {
2536
throw new Error('invalid OpenAPI path')
@@ -102,6 +113,10 @@ export async function upload({
102113
path.basename(pathToOpenApi)
103114
)
104115

116+
if (tags) {
117+
formData.append('tags', tags)
118+
}
119+
105120
if (process.env.GITHUB_WORKFLOW) {
106121
formData.append('workflow', process.env.GITHUB_WORKFLOW)
107122
}

0 commit comments

Comments
 (0)