You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add git and manual platform adapters
Add two new platform types that enable GTS to run outside GitHub
Actions and GitLab CI:
- `git` platform: reads commit metadata directly from git commands
(rev-parse, branch --show-current, describe --tags)
- `manual` platform: accepts commit SHA, ref name, tag, and change
request ID via CLI flags (--commit-sha, --ref-name, --git-tag,
--change-request-id) or GTS_ env vars
Split Platform interface: isSupported() moved to AutoDetectablePlatform,
which only CI adapters (GitHub, GitLab) implement. Auto-detection still
only considers CI platforms and throws if none match.
When platform is 'auto' and any manual CLI flag/env var is present,
automatically switches to the manual platform.
New CLI options: --platform, --commit-sha, --ref-name, --git-tag,
--change-request-id (each with GTS_ env var equivalents).
Closes#62
* fix: address PR review feedback
- Remove isSupported from mock platform in versionResolver.test.ts
(no longer part of Platform interface)
- Replace non-null assertions with empty string defaults in index.ts
manual opts construction — ManualPlatform constructor validates and
throws a clear error when required fields are missing
* fix: address second round of PR review feedback
- Mock executeCommand in git platform unit tests for determinism:
tests now assert exact git commands called and return values,
including detached HEAD fallback and tag-not-found error handling
- Export MANUAL_PLATFORM_REQUIRED_OPTIONS_ERROR constant from
manual.ts, reuse in index.ts and manual.test.ts
- Derive --platform CLI choices from allPlatformTypes instead of
hard-coding the list
* fix: restore executeCommand mock after git platform tests
mock.module is global in bun's test runner, so the mocked
executeCommand was leaking into process.test.ts and causing CI
failures. Import the real function before mocking and restore it
in afterAll.
* fix: use constructor injection instead of mock.module for git tests
mock.module in bun is process-global and leaks across test files
even with afterAll restoration. Switch to constructor injection:
GitPlatform accepts an optional CommandExecutor parameter (defaults
to executeCommand). Tests pass a mock function directly, avoiding
any global module state.
* fix: log platform resolution after successful construction
Log ManualPlatform resolution after successful construction, not
before — avoids misleading logs when constructor throws due to
missing required fields.
| GitHub Actions |`CI=true` + `GITHUB_ACTIONS=true`|`GITHUB_SHA`|`GITHUB_HEAD_REF` (PR, via `GITHUB_EVENT_NAME`) or `GITHUB_REF_NAME`|`GITHUB_REF_NAME` if `GITHUB_REF_TYPE=tag`|`pr-{N}` from `GITHUB_REF` (when `GITHUB_EVENT_NAME=pull_request`) |
187
-
| GitLab CI |`CI=true` + `GITLAB_CI=true`|`CI_COMMIT_SHA`|`CI_COMMIT_REF_NAME`|`CI_COMMIT_TAG`|`mr-{N}` from `CI_MERGE_REQUEST_IID`|
189
+
| Platform | Detection | SHA | Ref Name | Tag | Change Request |
| GitHub Actions |`CI=true` + `GITHUB_ACTIONS=true`|`GITHUB_SHA`|`GITHUB_HEAD_REF` (PR, via `GITHUB_EVENT_NAME`) or `GITHUB_REF_NAME`|`GITHUB_REF_NAME` if `GITHUB_REF_TYPE=tag`|`pr-{N}` from `GITHUB_REF` (when `GITHUB_EVENT_NAME=pull_request`) |
192
+
| GitLab CI |`CI=true` + `GITLAB_CI=true`|`CI_COMMIT_SHA`|`CI_COMMIT_REF_NAME`|`CI_COMMIT_TAG`|`mr-{N}` from `CI_MERGE_REQUEST_IID`|
0 commit comments