From 258b0ea9fcdd05221ebead5e5c162a7ad37c4412 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:30:36 +0100 Subject: [PATCH] Revert "Switch to using ``github.request``" This reverts commit f9c89e5d8431155caa7be57d923f96004a2dd4bd. --- .github/workflows/create-release.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 8fea865f506..f172f516eb2 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -41,21 +41,20 @@ jobs: // retrieve the ambient OIDC token const oidc_request_token = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN; const oidc_request_url = process.env.ACTIONS_ID_TOKEN_REQUEST_URL; - const oidc_resp = await github.request({ - url: `${oidc_request_url}&audience=testpypi`, + const oidc_resp = await fetch(`${oidc_request_url}&audience=testpypi`, { headers: {Authorization: `bearer ${oidc_request_token}`}, } ); - const oidc_token = oidc_resp.data.value; - + const oidc_token = (await oidc_resp.json()).value; + // exchange the OIDC token for an API token - const mint_resp = await github.request({ - url: 'https://test.pypi.org/_/oidc/github/mint-token', - method: 'post', - headers: {'Content-Type': 'application/json'}, - token: oidc_token, - }); - const api_token = mint_resp.data.token; + const mint_resp = await fetch('https://test.pypi.org/_/oidc/github/mint-token', { + method: 'post', + body: '{"token": "oidc_token"}' , + headers: {'Content-Type': 'application/json'}, + } + ); + const api_token = (await mint_resp.json()).token; // mask the newly minted API token, so that we don't accidentally leak it core.setSecret(api_token)