fix: log error responses when acquiring token

This commit is contained in:
Peter Evans
2021-06-15 10:42:23 +09:00
parent 73ac163f37
commit 54a7a303dd
3 changed files with 7775 additions and 90 deletions

View File

@@ -16,6 +16,11 @@ export async function getToken(
body: JSON.stringify(body),
headers: {'Content-Type': 'application/json'}
})
if (!response.ok) {
throw new Error(
`Unexpected response: ${response.status} ${response.statusText}`
)
}
const json = await response.json()
core.setSecret(json['token'])
return json['token']