mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
Parse body to get substring
This commit is contained in:
parent
fab839e73c
commit
9a13084841
1 changed files with 8 additions and 4 deletions
|
@ -36,11 +36,15 @@ async function getAuthToken(
|
||||||
});
|
});
|
||||||
let response: hc.HttpClientResponse = await httpClient.get(authUrl);
|
let response: hc.HttpClientResponse = await httpClient.get(authUrl);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
/**
|
||||||
|
* constains string _auth = ***OmV5***\nalways-auth = true
|
||||||
|
* we will parse it by using indexes
|
||||||
|
*/
|
||||||
let body: string = await response.readBody();
|
let body: string = await response.readBody();
|
||||||
core.info(body);
|
const startIndex = body.indexOf('_auth') + 8;
|
||||||
let data: any = JSON.parse(body);
|
const endIndex = body.indexOf('\n');
|
||||||
core.info(JSON.stringify(data));
|
const authToken = body.substring(startIndex, endIndex);
|
||||||
return '';
|
return authToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function writeRegistryToFile(
|
async function writeRegistryToFile(
|
||||||
|
|
Loading…
Add table
Reference in a new issue