Issue 401 GitHub action outputs #1403
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Resolves: #401
Adds four new GitHub Action outputs to provide access to release asset information:
id: The GitHub release ID for API interactionsupload_url: The upload URL template for adding additional assetsassets: JSON array of all uploaded asset metadataassets_dist: JSON object organizing distribution files by type (wheel/sdist)These outputs enable downstream workflow steps to programmatically access and process release artifacts, download specific distribution files, or interact with the release via the GitHub API.
Rationale
The implementation follows the existing pattern established in
VersionGitHubActionsOutput:Data Structure: Created a
ReleaseInfoNamedTuple in the GitHub HVCS to encapsulate release metadata (id, upload_url, assets) returned from the GitHub API. This provides a clean, typed structure for passing release information.Property Design: Added validated properties to
VersionGitHubActionsOutputthat:JSON Serialization: Used
json.dumps()for complex data structures (assets list and assets_dist dict) to ensure proper formatting in GitHub Actions output files.Computed Property: Implemented
assets_distas a computed property that categorizes assets by file extension (.whl → "wheel", .tar.gz → "sdist"). This provides convenience for common use cases without requiring users to parse the assets array.Type Safety: Updated the HVCS base class and all implementations to maintain type consistency with Union types, ensuring compatibility across different hosting services.
Problems Avoided:
How did you test?
Unit Tests (9 new tests in
test_github_actions_output.py)assets_distcorrectly categorizes .whl and .tar.gz filestest_version_github_actions_output_formatto expect new fields with proper line ending handlingE2E Test (updated
test_version_writes_github_actions_output)--no-pushflag where fields are empty (no GitHub release created)Manual Validation
ruff formatandruff check- all checks passmypy .- no type errorsEdge Cases Considered:
How to Verify
Checkout and setup:
Run unit tests:
All 19 tests should pass, including the 9 new tests for release asset outputs.
Run E2E test:
Test should pass and verify new fields are written to GITHUB_OUTPUT.
Run type checking:
Should complete with no errors.
Run linting:
All checks should pass.
Review documentation:
Open
docs/configuration/automatic-releases/github-actions.rstand verify:id,upload_url,assets,assets_distReview action definition:
Check
action.ymlto confirm all four outputs are defined with descriptions.PR Completion Checklist
Reviewed & followed the Contributor Guidelines
Changes Implemented & Validation pipeline succeeds
Commits follow the Conventional Commits standard
and are separated into the proper commit type and scope (recommended order: test, build, feat/fix, docs)
Appropriate Unit tests added/updated
Appropriate End-to-End tests added/updated
Appropriate Documentation added/updated and syntax validated for sphinx build (see Contributor Guidelines)