fix: truncate each tag individually in multi-tag templates#655
Merged
Conversation
borislavr
approved these changes
Mar 16, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Fix incorrect tag truncation in
metadata-actionwhendefault-templateproduces multiple comma-separated tags. Previously, the entire rendered string was truncated as a single value, which caused trailing tags (e.g.{{short-sha}}) to be silently dropped. Now each tag is truncated independently.Issue
Fixes #654
Breaking Change?
Scope / Project
actions/metadata-actionImplementation Notes
The root cause was in
src/index.js: afterfillTemplate()renders the template string, the result was passed directly totruncateTag()as one string. For a template like:this produced a 155-char string that got sliced to 128, cutting off the last tags entirely.
Fix: split the rendered string by
,, trim each part, truncate each tag individually totag-max-length, then rejoin with", ". Extra tags (fromextra-tagsinput) were already handled per-tag and required no changes.Documentation in
README.mdupdated to reflect the new per-tag truncation behavior, including an example from the original bug report.Tests / Evidence
New integration test added in
tests/integration.index.render.test.js:Simulates a long branch name (
fix-increase-integration-tests-memory) with template producing 4 comma-separated tags. Asserts:{{short-sha}}tag (11 chars) is present and correct in the outputAll 35 tests pass:
Additional Notes
The fix is backward-compatible - single-tag templates behave identically to before (split by
,produces one element, truncated as usual).