Skip to content

fix: seed counters from existing git tags to prevent duplicates - #4

Merged
nadaverell merged 3 commits into
mainfrom
fix/counter-respect-existing-tags
Mar 19, 2026
Merged

nadaverell merged 3 commits into
mainfrom
fix/counter-respect-existing-tags

Conversation

@nadaverell

Copy link
Copy Markdown
Contributor

Summary

  • Matrix builder's in-memory counter reset every run, always starting from _01
  • Two pushes to main on the same day generated identical service_tag values
  • Now queries git ls-remote --tags origin to find highest existing counter per service before building the matrix

Root cause

buildMatrixFromSkyhook increments a per-service counter within a single run (for service x environment disambiguation), but the counter map starts empty each run. It never checks what tags already exist on the remote.

Changes

  • index.js: Added getExistingTagCounters() that queries remote tags and finds the highest _NN counter per service for the given tag base
  • Merges git tag counters with any Koala-sourced counters (takes the higher value)
  • Rebuilt dist/index.js

Related

Test plan

  • Existing unit tests pass (12/12 - verified locally)
  • CI passes

The Skyhook matrix builder used an in-memory counter that reset every run,
always starting from _01. Two pushes to main on the same day would generate
identical service tags, causing `gh release create` to fail with
`Release.tag_name already exists`.

Now queries `git ls-remote --tags origin` before building the matrix to find
the highest existing counter per service for the given tag base, and starts
from there. This aligns with how determine-image-tag handles counters.
@nadaverell
nadaverell requested a review from hisco March 17, 2026 10:41
@nadaverell
nadaverell merged commit aa2c007 into main Mar 19, 2026
4 checks passed
@nadaverell
nadaverell deleted the fix/counter-respect-existing-tags branch March 19, 2026 10:05
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants