From 9b2f7b4d545f3f02af5f41ab9b7b909601fa50d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 27 Oct 2026 00:14:55 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(publish-github-release):=20m?= =?UTF-8?q?atch=20stored=20asset=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub stores an uploaded asset with characters such as spaces replaced by periods, so the asset check never found PyVenvManage's signed plugin ZIP and left the v2.4.7 draft unpublished. Expected names now follow the same rule. --- changelog.d/+release-asset-names.bugfix.md | 2 ++ publish-github-release/action.yml | 3 +++ tests/publish_github_release/test_publish.py | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/+release-asset-names.bugfix.md diff --git a/changelog.d/+release-asset-names.bugfix.md b/changelog.d/+release-asset-names.bugfix.md new file mode 100644 index 0000000..76599d8 --- /dev/null +++ b/changelog.d/+release-asset-names.bugfix.md @@ -0,0 +1,2 @@ +Match release assets by the name GitHub stores, which replaces characters such as spaces with periods. A file named +`PyVenv Manage 2-2.4.7-signed.zip` uploaded, but its draft stayed unpublished because the check expected the local name. diff --git a/publish-github-release/action.yml b/publish-github-release/action.yml index ec7428c..790d1ee 100644 --- a/publish-github-release/action.yml +++ b/publish-github-release/action.yml @@ -36,7 +36,9 @@ runs: shopt -s nullglob dotglob : >"$RUNNER_TEMP/release-assets.tsv" for asset in "$ASSETS_DIRECTORY"/*; do + # GitHub stores an uploaded asset under its file name with each other character replaced by a period. name=${asset##*/} + name=${name//[^A-Za-z0-9._+-]/.} printf '%s\tsha256:%s\n' "$name" "$(sha256sum "$asset" | cut -d' ' -f1)" \ >>"$RUNNER_TEMP/release-assets.tsv" done @@ -149,6 +151,7 @@ runs: present=0 for asset in "$ASSETS_DIRECTORY"/*; do name=${asset##*/} + name=${name//[^A-Za-z0-9._+-]/.} if jq -e --arg name "$name" --slurpfile assets "$RUNNER_TEMP/release-assets.json" ' any(.[0].assets[]; .name == $name and .state == "uploaded" and (.digest as $digest | any($assets[0][]; .name == $name and .digest == $digest))) diff --git a/tests/publish_github_release/test_publish.py b/tests/publish_github_release/test_publish.py index aa3a829..b4e8b94 100644 --- a/tests/publish_github_release/test_publish.py +++ b/tests/publish_github_release/test_publish.py @@ -338,7 +338,8 @@ def test_draft_release_uploads_missing_asset( assets.mkdir() asset_path = assets / asset_name asset_path.write_bytes(b"release archive") - asset = {"name": asset_name, "digest": f"sha256:{sha256(b'release archive').hexdigest()}", "state": "uploaded"} + stored = asset_name.replace(" ", ".") + asset = {"name": stored, "digest": f"sha256:{sha256(b'release archive').hexdigest()}", "state": "uploaded"} draft = _release(notes, draft=True) complete = _release(notes, draft=True, assets=[asset]) prefix = "/api/v3/repos/tox-dev/fixture"