mirror of
https://github.com/pypa/gh-action-pypi-publish.git
synced 2024-11-22 00:21:08 -05:00
Merge pull request #270 from trail-of-forks/fix-magic-link-summary
Some checks are pending
🧪 / smoke-test (push) Waiting to run
Some checks are pending
🧪 / smoke-test (push) Waiting to run
This commit is contained in:
commit
85a5a80b22
1 changed files with 15 additions and 9 deletions
|
@ -69,11 +69,15 @@ The workflow was run with 'attestations: true' input, but the specified \
|
||||||
repository URL does not support PEP 740 attestations. As a result, the \
|
repository URL does not support PEP 740 attestations. As a result, the \
|
||||||
attestations input is ignored."
|
attestations input is ignored."
|
||||||
|
|
||||||
MAGIC_LINK_MESSAGE="::warning title=Create a Trusted Publisher::\
|
MAGIC_LINK_MESSAGE="A new Trusted Publisher for the currently running \
|
||||||
A new Trusted Publisher for the currently running publishing workflow can be created \
|
publishing workflow can be created by accessing the following link(s) while \
|
||||||
by accessing the following link(s) while logged-in as an owner of the package(s):"
|
logged-in as an owner of the package(s):"
|
||||||
|
|
||||||
if [[ ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org || ${#PACKAGE_NAMES[@]} -eq 0 ]] ; then
|
|
||||||
|
[[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] \
|
||||||
|
&& TRUSTED_PUBLISHING=true || TRUSTED_PUBLISHING=false
|
||||||
|
|
||||||
|
if [[ "${TRUSTED_PUBLISHING}" == true || ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org || ${#PACKAGE_NAMES[@]} -eq 0 ]] ; then
|
||||||
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=""
|
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=""
|
||||||
else
|
else
|
||||||
if [[ "${INPUT_REPOSITORY_URL}" =~ test\.pypi\.org ]] ; then
|
if [[ "${INPUT_REPOSITORY_URL}" =~ test\.pypi\.org ]] ; then
|
||||||
|
@ -86,12 +90,14 @@ else
|
||||||
LINK="- ${INDEX_URL}/manage/project/${PACKAGE_NAME}/settings/publishing/?provider=github&owner=${GITHUB_REPOSITORY_OWNER}&repository=${REPOSITORY_NAME}&workflow_filename=${WORKFLOW_FILENAME}"
|
LINK="- ${INDEX_URL}/manage/project/${PACKAGE_NAME}/settings/publishing/?provider=github&owner=${GITHUB_REPOSITORY_OWNER}&repository=${REPOSITORY_NAME}&workflow_filename=${WORKFLOW_FILENAME}"
|
||||||
ALL_LINKS+="$LINK"$'\n'
|
ALL_LINKS+="$LINK"$'\n'
|
||||||
done
|
done
|
||||||
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE="${MAGIC_LINK_MESSAGE}"$'\n'"${ALL_LINKS}"
|
|
||||||
echo "${MAGIC_LINK_MESSAGE}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] \
|
# Construct the summary message without the warning header
|
||||||
&& TRUSTED_PUBLISHING=true || TRUSTED_PUBLISHING=false
|
MAGIC_LINK_MESSAGE_WITH_LINKS="${MAGIC_LINK_MESSAGE}"$'\n'"${ALL_LINKS}"
|
||||||
|
echo "${MAGIC_LINK_MESSAGE_WITH_LINKS}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# The actual nudge in the log is formatted as a warning
|
||||||
|
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE="::warning title=Create a Trusted Publisher::${MAGIC_LINK_MESSAGE_WITH_LINKS}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${INPUT_ATTESTATIONS}" != "false" ]] ; then
|
if [[ "${INPUT_ATTESTATIONS}" != "false" ]] ; then
|
||||||
# Setting `attestations: true` without Trusted Publishing indicates
|
# Setting `attestations: true` without Trusted Publishing indicates
|
||||||
|
|
Loading…
Reference in a new issue