@@ -41,20 +41,21 @@ jobs:
41
41
// retrieve the ambient OIDC token
42
42
const oidc_request_token = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
43
43
const oidc_request_url = process.env.ACTIONS_ID_TOKEN_REQUEST_URL;
44
- const oidc_resp = await fetch(`${oidc_request_url}&audience=testpypi`, {
44
+ const oidc_resp = await github.request({
45
+ url: `${oidc_request_url}&audience=testpypi`,
45
46
headers: {Authorization: `bearer ${oidc_request_token}`},
46
47
}
47
48
);
48
- const oidc_token = (await oidc_resp.json()) .value;
49
-
49
+ const oidc_token = oidc_resp.data .value;
50
+
50
51
// exchange the OIDC token for an API token
51
- const mint_resp = await fetch('https://test.pypi.org/_/oidc/ github/mint-token', {
52
- method : ' post ' ,
53
- body : ' {"token": "oidc_token"} ' ,
54
- headers : {'Content-Type': 'application/json'},
55
- }
56
- );
57
- const api_token = (await mint_resp.json()) .token;
52
+ const mint_resp = await github.request( {
53
+ url : 'https://test.pypi.org/_/oidc/github/mint-token ',
54
+ method : 'post' ,
55
+ headers: {'Content-Type': 'application/json'},
56
+ token: oidc_token,
57
+ } );
58
+ const api_token = mint_resp.data .token;
58
59
59
60
// mask the newly minted API token, so that we don't accidentally leak it
60
61
core.setSecret(api_token)
0 commit comments