@@ -41,6 +41,10 @@ INPUT_SKIP_EXISTING="$(get-normalized-input 'skip-existing')"
41
41
INPUT_PRINT_HASH=" $( get-normalized-input ' print-hash' ) "
42
42
INPUT_ATTESTATIONS=" $( get-normalized-input ' attestations' ) "
43
43
44
+ REPOSITORY_NAME=" $( echo ${GITHUB_REPOSITORY} | cut -d' /' -f2) "
45
+ WORKFLOW_FILENAME=" $( echo ${GITHUB_WORKFLOW_REF} | cut -d' /' -f5- | cut -d' @' -f1) "
46
+ PACKAGE_NAME=" $( python /app/print-pkg-name.py ${INPUT_PACKAGES_DIR%%/ } ) "
47
+
44
48
PASSWORD_DEPRECATION_NUDGE=" ::error title=Password-based uploads disabled::\
45
49
As of 2024, PyPI requires all users to enable Two-Factor \
46
50
Authentication. This consequently requires all users to switch \
@@ -64,6 +68,20 @@ The workflow was run with 'attestations: true' input, but the specified \
64
68
repository URL does not support PEP 740 attestations. As a result, the \
65
69
attestations input is ignored."
66
70
71
+ if [[ ! " ${INPUT_REPOSITORY_URL} " =~ pypi\. org || -z " ${PACKAGE_NAME} " ]] ; then
72
+ TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=" "
73
+ else
74
+ if [[ " ${INPUT_REPOSITORY_URL} " =~ test\. pypi\. org ]] ; then
75
+ INDEX_URL=" https://test.pypi.org"
76
+ else
77
+ INDEX_URL=" https://pypi.org"
78
+ fi
79
+ TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=" ::warning title=Create a Trusted Publisher::\
80
+ A new Trusted Publisher for the currently running publishing workflow can be created \
81
+ by accessing the following link while logged-in as a maintainer of the package: \
82
+ ${INDEX_URL} /manage/project/${PACKAGE_NAME} /settings/publishing/?provider=github&owner=${GITHUB_REPOSITORY_OWNER} &repository=${REPOSITORY_NAME} &workflow_filename=${WORKFLOW_FILENAME} "
83
+ fi
84
+
67
85
[[ " ${INPUT_USER} " == " __token__" && -z " ${INPUT_PASSWORD} " ]] \
68
86
&& TRUSTED_PUBLISHING=true || TRUSTED_PUBLISHING=false
69
87
@@ -96,6 +114,7 @@ elif [[ "${INPUT_USER}" == '__token__' ]]; then
96
114
97
115
if [[ " ${INPUT_REPOSITORY_URL} " =~ pypi\. org ]]; then
98
116
echo " ${TRUSTED_PUBLISHING_NUDGE} "
117
+ echo " ${TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE} "
99
118
fi
100
119
else
101
120
echo \
105
124
if [[ " ${INPUT_REPOSITORY_URL} " =~ pypi\. org ]]; then
106
125
echo " ${PASSWORD_DEPRECATION_NUDGE} "
107
126
echo " ${TRUSTED_PUBLISHING_NUDGE} "
127
+ echo " ${TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE} "
108
128
exit 1
109
129
fi
110
130
fi
0 commit comments