Skip to content

Commit f9c89e5

Browse files
committed
Switch to using github.request
1 parent 52c7f66 commit f9c89e5

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

.github/workflows/create-release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,21 @@ jobs:
4141
// retrieve the ambient OIDC token
4242
const oidc_request_token = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
4343
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`,
4546
headers: {Authorization: `bearer ${oidc_request_token}`},
4647
}
4748
);
48-
const oidc_token = (await oidc_resp.json()).value;
49-
49+
const oidc_token = oidc_resp.data.value;
50+
5051
// 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;
5859
5960
// mask the newly minted API token, so that we don't accidentally leak it
6061
core.setSecret(api_token)

0 commit comments

Comments
 (0)