Skip to content

Commit

Permalink
safer env var handling
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 6, 2024
1 parent 5783324 commit 31b9533
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ runs:
# vis https://docs.pypi.org/trusted-publishers/using-a-publisher/#the-manual-way
export TWINE_PASSWORD=$(
python -c 'import json, urllib.request as req
audience = req.urlopen("'${INPUT_REGISTRY_DOMAIN}'/_/oidc/audience").read()
audience = req.urlopen(os.getenv("INPUT_REGISTRY_DOMAIN") + "/_/oidc/audience").read()
token = json.load(req.urlopen(req.Request(
url="'${ACTIONS_ID_TOKEN_REQUEST_URL}'",
url=os.getenv("ACTIONS_ID_TOKEN_REQUEST_URL"),
data=audience,
headers={"Authorization": "bearer '${ACTIONS_ID_TOKEN_REQUEST_TOKEN}'"})))
headers={"Authorization": "bearer " + os.getenv("ACTIONS_ID_TOKEN_REQUEST_TOKEN")})))
print(json.load(req.urlopen(req.Request(
url="https://'${INPUT_REGISTRY_DOMAIN}'/_/oidc/github/mint-token",
url=os.getenv("INPUT_REGISTRY_DOMAIN") + "/_/oidc/github/mint-token",
data=json.dumps({"token": token["value"]}).encode(),
method="POST")))["token"], end="")')
fi
Expand Down

0 comments on commit 31b9533

Please sign in to comment.