Skip to content

Commit

Permalink
Add magic links to step summary
Browse files Browse the repository at this point in the history
  • Loading branch information
facutuesca committed Sep 3, 2024
1 parent 7d02474 commit 5e98273
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion print-pkg-names.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def safe_parse_pkg_name(file_path: pathlib.Path) -> str | None:
return None


packages_dir = pathlib.Path(sys.argv[1]).resolve().absolute()
packages_dir = pathlib.Path(sys.argv[1]).resolve()

pkg_names = {safe_parse_pkg_name(f) for f in packages_dir.iterdir()}
pkg_names.discard(None)
Expand Down
4 changes: 3 additions & 1 deletion requirements/runtime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ multidict==6.0.5
nh3==0.2.17
# via readme-renderer
packaging==24.1
# via pypi-attestations
# via
# -r runtime.in
# pypi-attestations
pkginfo==1.10.0
# via twine
platformdirs==4.2.2
Expand Down
12 changes: 7 additions & 5 deletions twine-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ The workflow was run with 'attestations: true' input, but the specified \
repository URL does not support PEP 740 attestations. As a result, the \
attestations input is ignored."

MAGIC_LINK_MESSAGE="::warning title=Create a Trusted Publisher::\
A new Trusted Publisher for the currently running publishing workflow can be created \
by accessing the following link(s) while logged-in as an owner of the package(s):"

if [[ ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org || ${#PACKAGE_NAMES[@]} -eq 0 ]] ; then
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE=""
else
Expand All @@ -79,13 +83,11 @@ else
fi
ALL_LINKS=""
for PACKAGE_NAME in "${PACKAGE_NAMES[@]}"; do
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'
done
TRUSTED_PUBLISHING_MAGIC_LINK_NUDGE="::warning title=Create a Trusted Publisher::\
A new Trusted Publisher for the currently running publishing workflow can be created \
by accessing the following link(s) while logged-in as a maintainer of the package(s): \"
${ALL_LINKS}"
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}" ]] \
Expand Down

0 comments on commit 5e98273

Please sign in to comment.