Remaining refinements: tests, pre-release support, PR label strategy#40
Merged
Conversation
- error.rs: derive Clone + PartialEq to support test assertions - models.rs: derive Clone on TagName and CreateReleaseRequest - github_client.rs: extract GithubApi trait; move HTTP status/JSON handling from releases.rs into GithubClient's impl - releases.rs: make Releases<C: GithubApi> generic; add 5 tests via MockGithubApi (request fields, error propagation, None on 404) - config.rs: add 6 tests covering required fields, missing vars, invalid strategy, custom prefix/version, dry-run flag - semver.rs: add 7 from_str error cases (empty, malformed, leading zeros, pre-release suffix) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- semver.rs: add PreRelease struct; update regex to parse -id.N suffix; add base_version(), with_pre_release(), bump_pre_release(), pre_release_matches(); increment() strips pre-release on all arms; get_version() includes pre-release suffix; 5 new tests - config.rs: add prerelease (bool) and prerelease_identifier (String) fields read from INPUT_PRERELEASE / INPUT_PRERELEASE-IDENTIFIER - releases.rs: pass config.prerelease into CreateReleaseRequest - main.rs: NoRelease early-exit skipped when prerelease=true; version computation branches on prerelease — bumps counter if same identifier, otherwise applies strategy to base and starts at .1 - action.yaml: add prerelease and prerelease-identifier inputs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- semver.rs: derive Clone on VersionIncrementStrategy
- models.rs: add Label and PullRequest models
- github_client.rs: add get_pr_for_commit to GithubApi trait;
implement via GET /repos/{owner}/{repo}/commits/{sha}/pulls
- config.rs: add use_label_strategy, label_major, label_minor,
label_patch, label_skip fields (all optional with sensible defaults)
- releases.rs: expose get_pr_for_commit; update MockGithubApi with
pr_response field and with_pr_labels builder; add 2 new tests
- main.rs: add resolve_label_strategy (major > minor > skip > patch >
fallback); run() fetches PR and resolves strategy when
use_label_strategy=true; 6 new tests for label resolution
- action.yaml: add use-label-strategy, label-major, label-minor,
label-patch, label-skip inputs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Three refinements shipped in one branch, each as its own commit.
#4 — Tests
error.rs: deriveClone + PartialEqmodels.rs: deriveCloneonTagNameandCreateReleaseRequestgithub_client.rs: extractGithubApitrait; HTTP status/JSON handling moved fromreleases.rsintoGithubClient's implreleases.rs:Releases<C: GithubApi>— generic over client; 5 tests viaMockGithubApiconfig.rs: 6 tests covering required fields, missing vars, invalid strategy, custom prefix/version, dry-runsemver.rs: 7from_strerror cases (empty, malformed, leading zeros, pre-release suffix)#2 — Pre-release support
semver.rs:PreReleasestruct; regex updated to parse-id.N;base_version(),with_pre_release(),bump_pre_release(),pre_release_matches();increment()strips pre-release;get_version()includes suffix; 5 new testsconfig.rs:prerelease+prerelease_identifierfieldsreleases.rs:CreateReleaseRequest.prereleasewired from configmain.rs: pre-release branch — bumps counter when same identifier, otherwise applies strategy to base at.1;NoReleaseearly-exit skipped whenprerelease=trueaction.yaml:prerelease+prerelease-identifierinputs#1 — PR label strategy
models.rs:Label+PullRequestmodelsgithub_client.rs:get_pr_for_commiton trait + impl (GET /commits/{sha}/pulls)config.rs:use_label_strategy,label_major/minor/patch/skipfieldsreleases.rs:get_pr_for_commitdelegator; 2 new testsmain.rs:resolve_label_strategy(major > minor > skip > patch > config fallback); 6 new testsaction.yaml:use-label-strategy,label-major/minor/patch/skipinputsTest plan
cargo test— 31 tests, all green🤖 Generated with Claude Code