File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 1+ import * as core from '@actions/core'
12import { readFileSync } from 'node:fs'
23
34/**
@@ -23,18 +24,25 @@ export async function upload(
2324 throw new Error ( 'invalid OpenAPI path' )
2425 }
2526
26- let formData = [
27- [ encodeURIComponent ( 'openapi' ) , encodeURIComponent ( data . toString ( ) ) ]
28- ]
27+ const formData : Record < string , string | number | boolean > = {
28+ github_repo : process . env . GITHUB_REPOSITORY ! ,
29+ github_repo_id : process . env . GITHUB_REPOSITORY_ID ! ,
30+ openapi : data . toString ( )
31+ }
2932
3033 if ( dryRun ) {
31- formData = [
32- ...formData ,
33- [ encodeURIComponent ( 'dry-run' ) , encodeURIComponent ( dryRun ) ]
34- ]
34+ formData [ 'dry-run' ] = dryRun
3535 }
3636
37- const body = formData . flatMap ( arr => arr . join ( '=' ) ) . join ( '&' )
37+ core . debug ( `GitHub repo: ${ process . env . GITHUB_REPOSITORY } ` )
38+ core . debug ( `GitHub repo ID: ${ process . env . GITHUB_REPOSITORY_ID } ` )
39+
40+ const body = Object . entries ( formData )
41+ . flatMap (
42+ ( [ key , value ] ) =>
43+ `${ encodeURIComponent ( key ) } =${ encodeURIComponent ( value ) } `
44+ )
45+ . join ( '&' )
3846
3947 const response = await fetch (
4048 'https://platform-production-25fb.up.railway.app/api/openapi' ,
You can’t perform that action at this time.
0 commit comments