File tree Expand file tree Collapse file tree 4 files changed +19
-15
lines changed Expand file tree Collapse file tree 4 files changed +19
-15
lines changed Original file line number Diff line number Diff line change 34
34
id : upload-yaml-openapi-spec
35
35
uses : ./
36
36
with :
37
+ base-url : https://grouse-factual-internally.ngrok-free.app
37
38
dry-run : true
38
39
hey-api-token : ${{ secrets.HEY_API_TOKEN }}
39
40
path-to-openapi : ./openapi.yaml
Original file line number Diff line number Diff line change 1
1
<div align =" center " >
2
- <img width = " 150 " height =" 150 " src =" https://heyapi.vercel.app/ logo.png " alt = " Logo " >
2
+ <img alt = " Hey API logo " height =" 150 " src =" https://heyapi.dev/images/ logo-300w .png " width = " 150 " >
3
3
<h1 align =" center " ><b >Upload OpenAPI Specification</b ></h1 >
4
- <p align =" center " >A GitHub Action that uploads your OpenAPI specifications to Hey API 🚀 </p >
4
+ <p align =" center " >🚀 A GitHub Action that uploads your OpenAPI specifications to Hey API</p >
5
5
</div >
6
6
7
7
To use this action, you have to be registered with
8
- [ Hey API] ( https://heyapi.vercel.app / ) . If you don't have an account, please
9
- [ email us
] ( mailto:[email protected] ) or
8
+ [ Hey API] ( https://heyapi.dev / ) . If you don't have an account, please
9
+ [ email us
] ( mailto:[email protected] ) or
10
10
[ open an issue] ( https://github.com/hey-api/upload-openapi-spec/issues ) and we
11
11
will set you up.
12
12
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ export async function run(): Promise<void> {
11
11
core . getInput ( 'dry-run' , {
12
12
required : false
13
13
} ) === 'true'
14
+ const baseUrl : string = core . getInput ( 'base-url' , {
15
+ required : false
16
+ } )
14
17
const heyApiToken : string = core . getInput ( 'hey-api-token' , {
15
18
required : true
16
19
} )
@@ -21,6 +24,7 @@ export async function run(): Promise<void> {
21
24
core . debug ( `Path to OpenAPI: ${ pathToOpenApi } ` )
22
25
core . debug ( `Upload started: ${ new Date ( ) . toTimeString ( ) } ` )
23
26
await upload ( {
27
+ baseUrl,
24
28
dryRun,
25
29
heyApiToken,
26
30
pathToOpenApi,
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import { readFileSync } from 'node:fs'
4
4
* Read and upload the provided OpenAPI specification to Hey API.
5
5
*/
6
6
export async function upload ( {
7
+ baseUrl = 'https://platform-production-25fb.up.railway.app' ,
7
8
dryRun,
8
9
heyApiToken,
9
10
pathToOpenApi,
10
11
} : {
12
+ baseUrl ?: string ;
11
13
dryRun ?: boolean ;
12
14
/**
13
15
* Hey API token.
@@ -46,17 +48,14 @@ export async function upload({
46
48
)
47
49
. join ( '&' )
48
50
49
- const response = await fetch (
50
- 'https://platform-production-25fb.up.railway.app/api/openapi' ,
51
- {
52
- body,
53
- headers : {
54
- Authorization : `Bearer ${ heyApiToken } ` ,
55
- 'Content-Type' : 'application/x-www-form-urlencoded'
56
- } ,
57
- method : 'POST'
58
- }
59
- )
51
+ const response = await fetch ( `${ baseUrl } /v1/specs` , {
52
+ body,
53
+ headers : {
54
+ Authorization : `Bearer ${ heyApiToken } ` ,
55
+ 'Content-Type' : 'multipart/form-data' ,
56
+ } ,
57
+ method : 'POST' ,
58
+ } ) ;
60
59
61
60
if ( response . status >= 300 ) {
62
61
const error = await response . json ( )
You can’t perform that action at this time.
0 commit comments