Skip to content

Commit 0bf742b

Browse files
authored
Merge pull request #143 from trail-of-forks/tob-rewrite-oidc-refs
This patch updates the user-facing OIDC mentions with the new "Trusted Publishing" term to make it cohesive with how the PyPI docs names things now.
2 parents 69efb8c + 30c3822 commit 0bf742b

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

README.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -62,36 +62,41 @@ The secret used in `${{ secrets.PYPI_API_TOKEN }}` needs to be created on the
6262
settings page of your project on GitHub. See [Creating & using secrets].
6363

6464

65-
### Publishing with OpenID Connect
65+
### Trusted publishing
6666

6767
> **IMPORTANT**: This functionality is in beta, and will not work for you
68-
> unless you're a member of the PyPI OIDC beta testers' group. For more
69-
> information, see [warehouse#12965].
68+
> unless you're a member of the PyPI trusted publishing beta testers' group.
69+
> For more information, see [warehouse#12965].
7070

71-
This action supports PyPI's [OpenID Connect publishing]
71+
> **NOTE**: Trusted publishing is sometimes referred to by its
72+
> underlying technology -- OpenID Connect, or OIDC for short.
73+
> If you see references to "OIDC publishing" in the context of PyPI,
74+
> this is what they're referring to.
75+
76+
This action supports PyPI's [trusted publishing]
7277
implementation, which allows authentication to PyPI without a manually
7378
configured API token or username/password combination. To perform
74-
[OIDC publishing][OpenID Connect Publishing] with this action, your project's
75-
OIDC publisher must already be configured on PyPI.
79+
[trusted publishing] with this action, your project's
80+
publisher must already be configured on PyPI.
7681

77-
To enter the OIDC flow, configure this action's job with the `id-token: write`
78-
permission and **without** an explicit username or password:
82+
To enter the trusted publishing flow, configure this action's job with the
83+
`id-token: write` permission and **without** an explicit username or password:
7984

8085
```yaml
8186
jobs:
8287
pypi-publish:
8388
name: Upload release to PyPI
8489
runs-on: ubuntu-latest
8590
permissions:
86-
id-token: write # IMPORTANT: this permission is mandatory for OIDC publishing
91+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
8792
steps:
8893
# retrieve your distributions here
8994
9095
- name: Publish package distributions to PyPI
9196
uses: pypa/gh-action-pypi-publish@release/v1
9297
```
9398

94-
Other indices that support OIDC publishing can also be used, like TestPyPI:
99+
Other indices that support trusted publishing can also be used, like TestPyPI:
95100

96101
```yaml
97102
- name: Publish package distributions to TestPyPI
@@ -268,4 +273,4 @@ https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direc
268273
https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md
269274

270275
[warehouse#12965]: https://github.com/pypi/warehouse/issues/12965
271-
[OpenID Connect Publishing]: https://pypi.org/help/#openid-connect
276+
[trusted publishing]: https://docs.pypi.org/trusted-publishers/

oidc-exchange.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# The top-level error message that gets rendered.
1414
# This message wraps one of the other templates/messages defined below.
1515
_ERROR_SUMMARY_MESSAGE = """
16-
Trusted publisher (OIDC) exchange failure:
16+
Trusted publishing exchange failure:
1717
1818
{message}
1919
@@ -24,11 +24,14 @@
2424
names.
2525
2626
Read more about trusted publishers at https://docs.pypi.org/trusted-publishers/
27+
28+
Read more about how this action uses trusted publishers at
29+
https://github.com/marketplace/actions/pypi-publish#trusted-publishing
2730
"""
2831

2932
# Rendered if OIDC identity token retrieval fails for any reason.
3033
_TOKEN_RETRIEVAL_FAILED_MESSAGE = """
31-
OIDC token retrieval failed: {identity_error}
34+
OpenID Connect token retrieval failed: {identity_error}
3235
3336
This generally indicates a workflow configuration error, such as insufficient
3437
permissions. Make sure that your workflow has `id-token: write` configured
@@ -71,7 +74,7 @@ def die(msg: str) -> NoReturn:
7174
with _GITHUB_STEP_SUMMARY.open("a", encoding="utf-8") as io:
7275
print(_ERROR_SUMMARY_MESSAGE.format(message=msg), file=io)
7376

74-
print(f"::error::OIDC exchange failure: {msg}", file=sys.stderr)
77+
print(f"::error::Trusted publishing exchange failure: {msg}", file=sys.stderr)
7578
sys.exit(1)
7679

7780

@@ -94,12 +97,14 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
9497
case HTTPStatus.FORBIDDEN:
9598
# This index supports OIDC, but forbids the client from using
9699
# it (either because it's disabled, limited to a beta group, etc.)
97-
die(f"audience retrieval failed: repository at {domain} has OIDC disabled")
100+
die(
101+
f"audience retrieval failed: repository at {domain} has trusted publishing disabled",
102+
)
98103
case HTTPStatus.NOT_FOUND:
99104
# This index does not support OIDC.
100105
die(
101106
"audience retrieval failed: repository at "
102-
f"{domain} does not indicate OIDC support",
107+
f"{domain} does not indicate trusted publishing support",
103108
)
104109
case other:
105110
status = HTTPStatus(other)
@@ -124,7 +129,7 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
124129

125130
oidc_audience = audience_resp.json()["audience"]
126131

127-
debug(f"selected OIDC token exchange endpoint: {token_exchange_url}")
132+
debug(f"selected trusted publishing exchange endpoint: {token_exchange_url}")
128133

129134
try:
130135
oidc_token = id.detect_credential(audience=oidc_audience)

twine-upload.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if [[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] ; then
4444
# No password supplied by the user implies that we're in the OIDC flow;
4545
# retrieve the OIDC credential and exchange it for a PyPI API token.
4646
echo \
47-
'::notice::Attempting to perform OIDC credential exchange' \
47+
'::notice::Attempting to perform trusted publishing exchange' \
4848
'to retrieve a temporary short-lived API token for authentication' \
4949
"against ${INPUT_REPOSITORY_URL} due to __token__ username with no" \
5050
'supplied password field'

0 commit comments

Comments
 (0)