Skip to content

Conversation

@kochkarovv
Copy link

Add tag_search_pattern input for filtering tags by glob pattern

Summary

This PR adds a new input variable tag_search_pattern that allows filtering which tags are considered when determining the version to bump. This enables the action to work properly with projects that maintain multiple major versions simultaneously, especially when such versions have different root commits.

Problem

Currently, the action always considers all tags when determining the previous version to bump. For projects that maintain multiple major version branches in parallel (e.g., v1.x.x and v2.x.x), this can lead to incorrect version bumping because the action will always pick the highest semver tag regardless of which branch is being worked on.

Solution

The new tag_search_pattern input accepts a glob pattern (e.g., v1.*) that filters the tags to consider. When specified, only tags matching the pattern will be used to determine the previous version, allowing for proper versioning across multiple major version branches.

Example Use Case

For a project with tags v1.2.3 and v2.0.1:

  • When no tag_search_pattern is specified, the action works as before, finding v2.0.1 as the latest tag
  • When tag_search_pattern: "v1.*" is specified, the action will detect v1.2.3 as the last tag and create a new tag like v1.2.4

Changes

  • Added tag_search_pattern input parameter to action.yml
  • Updated getValidTags function in utils.ts to filter tags by pattern when provided
  • Added minimatch dependency for glob pattern matching
  • Added documentation in README.md with example workflow
  • Added test case to verify the functionality

Technical Details

  • Uses minimatch for glob pattern matching of tag names
  • Maintains backward compatibility (when no pattern is provided, behavior is unchanged)
  • Added appropriate logging to facilitate debugging when patterns are used

This enhancement allows for more flexible versioning strategies without breaking existing workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant