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 3434 id : upload-yaml-openapi-spec
3535 uses : ./
3636 with :
37+ base-url : https://grouse-factual-internally.ngrok-free.app
3738 dry-run : true
3839 hey-api-token : ${{ secrets.HEY_API_TOKEN }}
3940 path-to-openapi : ./openapi.yaml
Original file line number Diff line number Diff line change 11<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 " >
33 <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 >
55</div >
66
77To 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
1010[ open an issue] ( https://github.com/hey-api/upload-openapi-spec/issues ) and we
1111will set you up.
1212
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ export async function run(): Promise<void> {
1111 core . getInput ( 'dry-run' , {
1212 required : false
1313 } ) === 'true'
14+ const baseUrl : string = core . getInput ( 'base-url' , {
15+ required : false
16+ } )
1417 const heyApiToken : string = core . getInput ( 'hey-api-token' , {
1518 required : true
1619 } )
@@ -21,6 +24,7 @@ export async function run(): Promise<void> {
2124 core . debug ( `Path to OpenAPI: ${ pathToOpenApi } ` )
2225 core . debug ( `Upload started: ${ new Date ( ) . toTimeString ( ) } ` )
2326 await upload ( {
27+ baseUrl,
2428 dryRun,
2529 heyApiToken,
2630 pathToOpenApi,
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import { readFileSync } from 'node:fs'
44 * Read and upload the provided OpenAPI specification to Hey API.
55 */
66export async function upload ( {
7+ baseUrl = 'https://platform-production-25fb.up.railway.app' ,
78 dryRun,
89 heyApiToken,
910 pathToOpenApi,
1011} : {
12+ baseUrl ?: string ;
1113 dryRun ?: boolean ;
1214 /**
1315 * Hey API token.
@@ -46,17 +48,14 @@ export async function upload({
4648 )
4749 . join ( '&' )
4850
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+ } ) ;
6059
6160 if ( response . status >= 300 ) {
6261 const error = await response . json ( )
You can’t perform that action at this time.
0 commit comments