Skip to content

Add TAG_FROM_BRANCH — derive the tag from the release branch name #359

Description

@postalservice14

Current behaviour: On merge to a release branch the tag is bumped via #major/#minor/#patch tokens or DEFAULT_BUMP. With GitFlow-style release/X.Y.Z branches, the exact version is already decided by the branch name, yet a patch release still requires a manual #patch in the merge commit — and forgetting it silently produces a wrong (minor) tag.

Proposed enhancement: An opt-in TAG_FROM_BRANCH (default false) that takes the tag verbatim from the version embedded in the branch name — read from the merge/squash commit message, falling back to the current branch name. A configurable BRANCH_VERSION_REGEX (default release[/-]([0-9]+\.[0-9]+\.[0-9]+)) extracts the version. If no version is recoverable (e.g. a rebase-merge dropped the branch name) the action fails loudly instead of mis-tagging. CUSTOM_TAG keeps precedence; the WITH_V/TAG_PREFIX prefix is applied.

Why it helps most users: branch-name-driven versioning is a common pattern (GitFlow, release-please, GitVersion). It's fully opt-in (no change to existing workflows) and the regex is user-configurable, so it isn't tied to any one branch convention. Matching is done with bash [[ =~ ]]/BASH_REMATCH — no shell-injection surface from commit text.

Happy to open a PR (entrypoint.sh + README + bats tests) if this fits the project's scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions