Skip to content

Commit a1ce384

Browse files
committed
Check for Trusted Publishing in magic link logic
1 parent 897895f commit a1ce384

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

twine-upload.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ MAGIC_LINK_MESSAGE="::warning title=Create a Trusted Publisher::\
7373
A new Trusted Publisher for the currently running publishing workflow can be created \
7474
by accessing the following link(s) while logged-in as an owner of the package(s):"
7575

76-
if [[ ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org || ${#PACKAGE_NAMES[@]} -eq 0 ]] ; then
76+
77+
[[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] \
78+
&& TRUSTED_PUBLISHING=true || TRUSTED_PUBLISHING=false
79+
80+
if [[ "${TRUSTED_PUBLISHING}" == true || ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org || ${#PACKAGE_NAMES[@]} -eq 0 ]] ; then
7781
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=""
7882
else
7983
if [[ "${INPUT_REPOSITORY_URL}" =~ test\.pypi\.org ]] ; then
@@ -90,8 +94,6 @@ else
9094
echo "${MAGIC_LINK_MESSAGE}" >> $GITHUB_STEP_SUMMARY
9195
fi
9296

93-
[[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] \
94-
&& TRUSTED_PUBLISHING=true || TRUSTED_PUBLISHING=false
9597

9698
if [[ "${INPUT_ATTESTATIONS}" != "false" ]] ; then
9799
# Setting `attestations: true` without Trusted Publishing indicates

0 commit comments

Comments
 (0)