Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Bundle licenses at release time#12625

Merged
williammartin merged 3 commits intotrunkcli/cli:trunkfrom
wm-bundle-licenses-in-binariescli/cli:wm-bundle-licenses-in-binariesCopy head branch name to clipboard
Feb 18, 2026
Merged

Bundle licenses at release time#12625
williammartin merged 3 commits intotrunkcli/cli:trunkfrom
wm-bundle-licenses-in-binariescli/cli:wm-bundle-licenses-in-binariesCopy head branch name to clipboard

Conversation

@williammartin
Copy link
Member

@williammartin williammartin commented Feb 6, 2026

Description

We currently handle our license compliance by producing reports, and including licenses and NOTICES in our source code. We have a script that does this per GOOS but we started experiencing issues when GOARCH differences could result in failures on CI not noticed locally. We made an attempt to provide a matrix of these options but it gets pretty annoying. We'd also need to keep it updated as release targets change.

Separately, we also have this issue where every dependabot PR requires make licenses which is super annoying. This PR moves all of that to build time as a goreleaser hook, which already has GOOS and GOARCH, and then the results are bundled in the binary via embed and made available via gh licenses.

I don't think we have any obligation to solve for other people building/distributing an artifact, so the default embed has some help text.

Reviewer Notes

You can run ./script/release --local --platform <platform> to build under ./dist and use gh licenses to check the output.

You can also get a staging release from here: https://github.com/cli/cli/actions/runs/21755383986

It maybe adds about 1MB to the size of the binary, seems fast enough to run gh licenses

@williammartin williammartin force-pushed the wm-bundle-licenses-in-binaries branch 3 times, most recently from e76ba52 to 6c83778 Compare February 6, 2026 14:45
@williammartin williammartin force-pushed the wm-bundle-licenses-in-binaries branch from 6c83778 to 03ba23c Compare February 6, 2026 15:02
@williammartin williammartin force-pushed the wm-bundle-licenses-in-binaries branch from 03ba23c to 9c844a7 Compare February 6, 2026 15:07
@williammartin williammartin marked this pull request as ready for review February 6, 2026 15:16
@williammartin williammartin requested a review from a team as a code owner February 6, 2026 15:16
Copy link
Contributor

Copilot AI left a comment

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 modernizes the license compliance workflow by moving license generation from development time to build time. License information is now generated as a goreleaser pre-build hook for each platform and embedded into the binary via go:embed, making it accessible through a new gh licenses command. This eliminates the need to commit platform-specific license files to the repository and removes the requirement to run make licenses after every dependency update.

Changes:

  • Removed all committed third-party license files and reports from the repository
  • Modified script/licenses to support both single-platform generation and verification modes
  • Added goreleaser pre-build hooks to generate licenses for each build target
  • Introduced new gh licenses command to display embedded license information

Reviewed changes

Copilot reviewed 207 out of 207 changed files in this pull request and generated no comments.

Show a summary per file
File Description
third-party/*/LICENSE Removed all committed third-party license files
script/licenses-check Removed standalone license check script
script/licenses Refactored to support both build-time generation and CI verification
pkg/cmd/root/root.go Added licenses command to root command
pkg/cmd/licenses/licenses.go New command to display embedded license information
internal/licenses/licenses.go Core logic for embedding and formatting license content
internal/licenses/licenses_test.go Unit tests for license content generation
internal/licenses/embed/* Placeholder files for embedded license data
docs/license-compliance.md Updated documentation for new workflow
Makefile Updated license targets to use new script interface
.goreleaser.yml Added pre-build hooks to generate licenses
.github/workflows/lint.yml Updated CI to verify license generation
.github/secret_scanning.yml Removed exclusions for deleted license files
.github/licenses.tmpl Simplified template for embedded report

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

@williammartin williammartin force-pushed the wm-bundle-licenses-in-binaries branch from 9c844a7 to b510389 Compare February 18, 2026 15:47
# which causes go-licenses to raise "Package ... does not have module info" errors.
# For more information, https://github.com/google/go-licenses/issues/244#issuecomment-1885098633
#
# go-licenses has been pinned for automation use.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this comment is valid anymore

Suggested change
# go-licenses has been pinned for automation use.

paths-ignore:
- 'third-party/**'
- 'third-party-licenses.*.md'
paths-ignore: []
Copy link
Member

Choose a reason for hiding this comment

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

Could just delete this file, probably.

@BagToad
Copy link
Member

BagToad commented Feb 18, 2026

It maybe adds about 1MB to the size of the binary

Not sure it's practical, but maybe we could look at compressing the embedded licenses and decompressing them at runtime?

@williammartin williammartin merged commit 7ea88b1 into trunk Feb 18, 2026
11 checks passed
@williammartin williammartin deleted the wm-bundle-licenses-in-binaries branch February 18, 2026 16:59
williammartin added a commit that referenced this pull request Feb 18, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.