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'
1
2
import { readFileSync } from 'node:fs'
2
3
3
4
/**
@@ -23,18 +24,25 @@ export async function upload(
23
24
throw new Error ( 'invalid OpenAPI path' )
24
25
}
25
26
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
+ }
29
32
30
33
if ( dryRun ) {
31
- formData = [
32
- ...formData ,
33
- [ encodeURIComponent ( 'dry-run' ) , encodeURIComponent ( dryRun ) ]
34
- ]
34
+ formData [ 'dry-run' ] = dryRun
35
35
}
36
36
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 ( '&' )
38
46
39
47
const response = await fetch (
40
48
'https://platform-production-25fb.up.railway.app/api/openapi' ,
You can’t perform that action at this time.
0 commit comments