Skip to content

feat!: fill commitInfo from CI variables and release 2.0.0 - #13

Merged
agoldis merged 6 commits into
masterfrom
agoldis/commit-info-2.0.0
Oct 3, 2026
Merged

agoldis merged 6 commits into
masterfrom
agoldis/commit-info-2.0.0

Conversation

@agoldis

@agoldis agoldis commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

commitInfo() fills the fields git can't read from the CI provider's variables, takes remote from the CI provider before git, and prints one warning when git fails. These are the rules the Currents Playwright reporter applied itself; after this release the Playwright reporter and the CLI both drop their own copy and get the same values from here. Releases 2.0.0.

Breaking, because commitInfo() returns other values than 1.x:

  • Priority for branch, sha, message, author, email and timestamp: COMMIT_INFO_*, then git, then the CI provider. A detached HEAD is no branch; branch values are not otherwise rewritten.
  • remote: COMMIT_INFO_REMOTE, then the CI provider, then git, without credentials. Azure clones over SSH, and the CI variable has the pull request's HTTPS URL (ENG-563).
  • Two variables differ from the Playwright reporter, which were broken there:
    • Semaphore: SEMAPHORE_GIT_URL instead of SEMAPHORE_GIT_REPO_SLUG (owner/repo), which the server can't build commit links from.
    • Bamboo: bamboo_planRepository_repositoryUrl; the reporter read …repositoryURL, which Bamboo doesn't set.
  • One warning per process when git fails and fields stay empty, naming the COMMIT_INFO_* variables to set. No warning outside a repository on a developer machine.
  • index.d.ts with the types; ramda removed.

The CHANGELOG has the migration steps.

Verification

  • npm test: 113 passing, also on Node 16.20.2 and with CI=true GITHUB_ACTIONS=true. npm run lint, deps and size pass.
  • Old and new Playwright reporter and CLI run side by side over 1,512 generated scenarios (14 git states × 36 CI env sets × 3 COMMIT_INFO_* sets, 12,096 runs, 0 crashes). Every difference is one of: credentials removed, dubious ownership read on CI, COMMIT_INFO_REMOTE winning, the warning, the Semaphore and Bamboo fixes, or the CLI now matching the old Playwright reporter. No other differences. After the switch both consumers return identical commit fields in every scenario.
  • Six planted tokens: none in any new output, including DEBUG=*.
  • Consumer suites with this package: Playwright reporter 521 tests pass, CLI 422 tests pass; both build.
  • Not tested: Windows, Linux git 2.35.2 to 2.37.x.

Stacked on #12.

🤖 Generated with Claude Code

https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@baz-reviewer

baz-reviewer Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Baz Summary

Update commitInfo() to combine COMMIT_INFO_*, Git, and CI-provider metadata with provider-specific precedence, credential-free remotes, detached-HEAD handling, and targeted warnings. Add typed exports and CI helpers while removing the ramda runtime dependency and releasing version 2.0.0.

Topics

TopicDetails
Commit metadata flow Unify commit metadata resolution across Git, fallback environment variables, and supported CI providers, including pull-request data, detached branches, safe-directory retries, credential removal, and one-time diagnostics.
Modified files (6)
  • CHANGELOG.md
  • README.md
  • src/commit-info-repos-spec.js
  • src/git-api.js
  • src/index.js
  • src/utils.js
Latest Contributors(2)
UserCommitDate
agoldis@gmail.comfix: say when the fold...October 03, 2026
emilyrohrbough@yahoo.comchore: update readme &...April 03, 2023
Public API release Publish the breaking 2.0.0 API with TypeScript declarations, documented migration behavior, new CI and credential helpers, and reduced runtime dependencies.
Modified files (5)
  • CHANGELOG.md
  • package-lock.json
  • package.json
  • src/index.d.ts
  • src/utils-spec.js
Latest Contributors(2)
UserCommitDate
agoldis@gmail.comchore: release 2.0.0October 03, 2026
dj@currents.devchore: Update npm regi...October 17, 2024

Merger  Activate to get a short verdict whether this PR is good to go or not

Skills  Activate Skill Maintainer to keep your skills up to date

Planner  This PR would have been improved with Baz Planner - Try it now

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 9 billable files and costs up to $2.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 13 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 64 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: d62010ab-c452-4470-8e16-5334d814c92d
📥 Commits

Reviewing files that changed from the base of the PR and between d9363fd and 3f3f6d5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • CHANGELOG.md
  • README.md
  • package.json
  • src/commit-info-repos-spec.js
  • src/git-api.js
  • src/index.d.ts
  • src/index.js
  • src/utils-spec.js
  • src/utils.js
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Comment thread src/index.js
Comment thread src/index.js
Comment thread src/index.d.ts Outdated
@agoldis
agoldis force-pushed the agoldis/commit-info-2.0.0 branch from ddab3f7 to 2e9587c Compare October 3, 2026 04:59
agoldis and others added 3 commits October 2, 2026 22:02
commitInfo() takes each field from COMMIT_INFO_*, then git, then the CI
provider's variables, so the Currents CLI and reporter no longer combine
them themselves. The CI values are the ones the Playwright reporter read.
Branch values from COMMIT_INFO_BRANCH and CI are not changed; git's HEAD
is still no branch.

When git fails and fields stay empty, commitInfo() prints one warning per
process with the git error and the COMMIT_INFO_* variables to set. It
says so plainly when git is not in PATH. Outside a repository and off CI
there is no warning.

Adds TypeScript types. ramda is no longer used.

BREAKING CHANGE: commitInfo() returns CI provider values where 1.x
returned null, and can print a warning to stderr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
commitInfo() returns COMMIT_INFO_REMOTE, else the CI provider's remote,
else the git remote, as the Playwright reporter did with
CI_PREFERRED_KEYS (ENG-563). An Azure Pipelines clone often has an SSH
remote, and the pull request link needs the HTTPS URL in
BUILD_REPOSITORY_URI. The providers that set a remote are AWS CodeBuild,
Azure Pipelines, Bamboo, Buildkite, CircleCI, Drone, GitLab, Semaphore
and Netlify. Credentials are removed as before.

BREAKING CHANGE: on those providers commitInfo().remote is the CI
provider's remote, not the git remote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
@agoldis
agoldis force-pushed the agoldis/commit-info-2.0.0 branch from 2e9587c to d75c2ff Compare October 3, 2026 05:02
agoldis and others added 2 commits October 2, 2026 22:07
Node reports a cwd that does not exist as `spawn git ENOENT`, the same error
as a missing git, so commitInfo('/missing') warned that git was not in PATH.
A folder that does not exist now counts as no repository: no warning outside
CI, and on CI the warning names the folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
getGhaEventData copies the fields from the GitHub event payload without
checking them, so a payload without a sender gives undefined
senderAvatarUrl and senderHtmlUrl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
Base automatically changed from agoldis/commit-info-fixes to master October 3, 2026 05:08
Comment thread src/index.d.ts Outdated
Comment thread src/index.js
…iteral type

The generic return type kept a literal input type, such as
'https://user:token@host/x', although the function returns a different
string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KVkH9Ei4iCN2WvGMAUT1d
@agoldis
agoldis merged commit 3e40bd5 into master Oct 3, 2026
8 checks passed
@agoldis
agoldis deleted the agoldis/commit-info-2.0.0 branch October 3, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant