Repository navigation
feat: add string-token bump strategy - #11
Closed
ihabsoliman wants to merge 3 commits into
Closed
ihabsoliman wants to merge 3 commits into
ihabsoliman wants to merge 3 commits into
Conversation
Adds `bump_strategy: string-token` as an alternative to conventional
commits, for teams that mark release intent with magic substrings in
commit messages (`#major`/`#minor`/`#patch`/`#none` by default) rather
than structured commit headers.
Tag discovery, prefix scoping, prerelease handling and tag creation are
shared with the conventional-commits path; only bump derivation differs.
Three places do need their own behaviour under the new strategy, each
mirroring anothrNick/github-tag-action, from which the token convention
comes:
- The previous tag and commit-range base are always the latest *stable*
tag. The prerelease tag is consulted separately, as a
continue-or-restart switch. Incrementing from
max(stable, prerelease) instead would turn tags 1.4.0 + 1.4.1-RC.3
with a `#patch` commit into 1.4.2-RC.0 rather than 1.4.1-RC.4.
- When no tag matches the prefix yet, the commit range is empty rather
than "every commit reachable from HEAD", so the first tag of a new
prefixed lineage cannot be decided by an unrelated historical token.
- The closed-PR payload fallback is bypassed, since the bash
implementation has no equivalent and it would surface commits that a
`git log A..A` range never sees.
A `none` token, or no token with `default_bump: false`, skips tagging
but still echoes the existing stable tag into `new_tag`/`new_version`
instead of leaving them empty.
Also adds `pre_release`, to force pre-release on or off explicitly
rather than inferring it from branch regexes, and `token_match_mode`:
`word` (default) requires delimited, case-insensitive tokens, while
`substring` reproduces the legacy glob semantics under which `#patches`
triggers `#patch`.
Existing conventional-commits callers are unaffected: `bump_strategy`
defaults to `conventional-commits` and the whole feature is inert
unless it is set.
fix: normalize push payload commits in the closed-PR fallback
`getClosedPRCommits` read `commit.commit.message`, but `push` webhook
payload commits are `{ id, message, author }` with no nested `.commit`,
so it threw whenever it actually fired - on an empty compare range with
a push payload present. The shape conversion was also a `.filter` where
a `.map` was intended, which silently passed the original elements
through. Existing tests missed both because their fixtures used the
API-shaped `{ sha, commit: { message } }`.
ihabsoliman
force-pushed
the
legacy-token-mode
branch
from
September 8, 2026 21:58
a31982c to
ab0b8a2
Compare
tsconfig.json excludes `**/*.test.ts`, so the suites were never part of any tsc program: `npm run build` stayed green while 72 type errors accumulated in them, visible only in an editor. Adds tsconfig.tests.json and chains it into `build`, so CI enforces this from now on. It widens `rootDir` to the repo root because the base config aims it at ./src for an emit that never happens - the shipped bundle comes from esbuild. Fixes all 76 errors. 70 shared one cause: `jest.fn()` with no type argument is typed `Mock<UnknownFunction>`, whose parameter and resolved types collapse to `never`, so `mockResolvedValue`/`mockRejectedValue`/`mockImplementation` reject every argument. Each suite now builds its mocks through a small helper with a permissive signature. Typing them precisely instead - `jest.fn<typeof listTags>()` - would require widening dozens of intentionally-partial fixtures to full API types for no real safety gain. The remaining six: a `declare module '*?real'` for the unmocked-import trick (the suffix works by forming a distinct module specifier, so the factory registered for the unqueried path does not apply; moduleNameMapper is not involved), and `./helper.test` -> `./helper.test.js`, which jest maps back.
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.
Adds
bump_strategy: string-tokenas an alternative to conventional commits, for teams that mark release intent with magic substrings in commit messages (#major/#minor/#patch/#noneby default) rather than structured commit headers.Tag discovery, prefix scoping, prerelease handling and tag creation are shared with the conventional-commits path; only bump derivation differs. Three places do need their own behaviour under the new strategy, each mirroring anothrNick/github-tag-action, from which the token convention comes:
#patchcommit into 1.4.2-RC.0 rather than 1.4.1-RC.4.git log A..Arange never sees.A
nonetoken, or no token withdefault_bump: false, skips tagging but still echoes the existing stable tag intonew_tag/new_versioninstead of leaving them empty.Also adds
pre_release, to force pre-release on or off explicitly rather than inferring it from branch regexes, andtoken_match_mode:word(default) requires delimited, case-insensitive tokens, whilesubstringreproduces the legacy glob semantics under which#patchestriggers#patch.Existing conventional-commits callers are unaffected:
bump_strategydefaults toconventional-commitsand the whole feature is inert unless it is set.fix: normalize push payload commits in the closed-PR fallback
getClosedPRCommitsreadcommit.commit.message, butpushwebhook payload commits are{ id, message, author }with no nested.commit, so it threw whenever it actually fired - on an empty compare range with a push payload present. The shape conversion was also a.filterwhere a.mapwas intended, which silently passed the original elements through. Existing tests missed both because their fixtures used the API-shaped{ sha, commit: { message } }.