mirror of https://github.com/actions/toolkit
removed whitespaces
parent
0c1cb726c3
commit
5afccaa9db
|
@ -4,10 +4,8 @@ import {IHeaders} from '@actions/http-client/interfaces'
|
||||||
import {createHttpClient, isSuccessStatusCode} from './internal/utils'
|
import {createHttpClient, isSuccessStatusCode} from './internal/utils'
|
||||||
import {getIDTokenUrl} from './internal/config-variables'
|
import {getIDTokenUrl} from './internal/config-variables'
|
||||||
|
|
||||||
async function postCall(
|
async function postCall(id_token_url: string, audience: string): Promise<string> {
|
||||||
id_token_url: string,
|
|
||||||
audience: string
|
|
||||||
): Promise<string> {
|
|
||||||
const httpclient = createHttpClient()
|
const httpclient = createHttpClient()
|
||||||
if (httpclient === undefined) {
|
if (httpclient === undefined) {
|
||||||
throw new Error(`Failed to get Httpclient `)
|
throw new Error(`Failed to get Httpclient `)
|
||||||
|
@ -16,10 +14,8 @@ async function postCall(
|
||||||
core.debug(`Httpclient created ${httpclient} `) // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true
|
core.debug(`Httpclient created ${httpclient} `) // debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true
|
||||||
|
|
||||||
const additionalHeaders: IHeaders = {}
|
const additionalHeaders: IHeaders = {}
|
||||||
additionalHeaders[actions_http_client.Headers.ContentType] =
|
additionalHeaders[actions_http_client.Headers.ContentType] = actions_http_client.MediaTypes.ApplicationJson
|
||||||
actions_http_client.MediaTypes.ApplicationJson
|
additionalHeaders[actions_http_client.Headers.Accept] = actions_http_client.MediaTypes.ApplicationJson
|
||||||
additionalHeaders[actions_http_client.Headers.Accept] =
|
|
||||||
actions_http_client.MediaTypes.ApplicationJson
|
|
||||||
|
|
||||||
core.debug(`audience is ${audience !== null ? audience : 'null'}`)
|
core.debug(`audience is ${audience !== null ? audience : 'null'}`)
|
||||||
|
|
||||||
|
@ -56,10 +52,9 @@ export async function getIDToken(audience: string): Promise<string> {
|
||||||
core.debug(`ID token url is ${id_token_url}`)
|
core.debug(`ID token url is ${id_token_url}`)
|
||||||
|
|
||||||
let body: string = await postCall(id_token_url, audience)
|
let body: string = await postCall(id_token_url, audience)
|
||||||
|
|
||||||
let id_token = parseJson(body)
|
let id_token = parseJson(body)
|
||||||
|
|
||||||
return id_token
|
return id_token
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
return error.message
|
return error.message
|
||||||
|
|
Loading…
Reference in New Issue