Skip to content

feat: retrieve git metadata from local repo#12

Merged
alexanderbsingh merged 18 commits into
mainfrom
auto-add-git-metadata
Jul 9, 2026
Merged

feat: retrieve git metadata from local repo#12
alexanderbsingh merged 18 commits into
mainfrom
auto-add-git-metadata

Conversation

@alexanderbsingh

Copy link
Copy Markdown
Contributor
  • Adds a flag to automatically get git metadata
  • Adds an option to set a custom path to get the git metadata from

…a, and simplify environment variable parsing
…ection

- Added `--git-repo-path` flag for custom repository path during Git metadata auto-detection.
- Enhanced automatic Git metadata detection to log discovered metadata.
- Updated README with usage details for `--git-repo-path`.
- Improved tests to verify `--git-repo-path` functionality.
- Replaced manual shell-based Git metadata extraction with go-git library.
- Enhanced error handling for Git discovery process.
- Updated tests to reflect changes in Git metadata handling.
- Adjusted dependencies in `go.mod` and `go.sum`.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in mechanism to populate Git-related upload metadata (branch, commit SHA, origin) by querying a local Git repository, along with documentation and tests to validate the behavior.

Changes:

  • Adds --enable-auto-git-metadata (and BIFROST_ENABLE_AUTO_GIT_METADATA) plus --git-repo-path to support auto-discovery of Git metadata.
  • Implements Git metadata discovery via git -C <dir> ... and fills only missing metadata fields.
  • Updates README usage/examples and extends CLI tests to cover auto-discovery scenarios.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents manual vs. automatic Git metadata, new flags/env var, and updates the options table.
internal/bifrost/sbom_upload.go Hooks auto-discovery into SBOM upload task creation; prints auto-detected metadata and a missing-metadata hint.
internal/bifrost/options.go Adds new options/flags and reads BIFROST_ENABLE_AUTO_GIT_METADATA during validation.
internal/bifrost/git_metadata.go New helper to discover Git metadata by executing Git commands in a target repo directory.
internal/bifrost/cli_test.go Adds extensive coverage for auto Git metadata behavior and introduces stderr-capture + git repo helpers.
internal/bifrost/api.go Formatting-only change (field alignment).
go.mod Formatting-only change (closing paren alignment).
go.sum Formatting-only change (line indentation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/bifrost/options.go Outdated
Comment thread internal/bifrost/cli_test.go

This comment was marked as resolved.

This comment was marked as resolved.

@alexanderbsingh alexanderbsingh marked this pull request as ready for review July 8, 2026 07:06
@alexanderbsingh alexanderbsingh requested a review from konrader July 8, 2026 07:07
@alexanderbsingh alexanderbsingh merged commit 2d4ebf4 into main Jul 9, 2026
1 check passed
@alexanderbsingh alexanderbsingh deleted the auto-add-git-metadata branch July 9, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants