Repository navigation
Replace custom license-check with GitHub dependency-review-action - #1690
Conversation
📝 WalkthroughWalkthroughReplaces a removed license-check workflow with automated NOTICE generation and a new dependency-review workflow; adds a scripts/generate-notice.sh script and documentation; updates the autofix workflow to run NOTICE generation and adjusts workflow permissions. Changes
Sequence Diagram(s)sequenceDiagram
participant PR as Pull Request
participant DepReview as Dependency Review Workflow
participant Checkout as actions/checkout
participant SetupGo as actions/setup-go
participant DepAction as dependency-review-action
participant Script as generate-notice.sh
participant GoLic as go-licenses
participant Repo as Repository (NOTICE)
PR->>DepReview: trigger (opened/synchronize/reopened)
DepReview->>Checkout: checkout code
DepReview->>SetupGo: setup Go (from go.mod)
DepReview->>DepAction: run dependency review (deny list, vuln checks)
alt denied license or vuln found
DepAction->>PR: fail & comment
else pass
DepReview->>Script: run ./scripts/generate-notice.sh
Script->>GoLic: ensure installed / run report
GoLic-->>Script: license report
Script->>Script: parse & categorize licenses
Script->>Repo: write/update NOTICE
DepReview->>Repo: git diff NOTICE
alt NOTICE changed
DepReview->>PR: fail (NOTICE out of date)
else
DepReview->>PR: pass
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1690 +/- ##
==========================================
+ Coverage 66.43% 66.45% +0.02%
==========================================
Files 357 357
Lines 41126 41126
==========================================
+ Hits 27322 27331 +9
+ Misses 11768 11759 -9
Partials 2036 2036
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
Resolved conflict in .github/workflows/license-check.yml by: - Keeping our comprehensive license-check action approach - Adding timeout-minutes: 10 from main - Adding pull_request types filter from main - Preserving our action-based implementation with PR commenting
go-licenses v1.6.0 fails when encountering stdlib packages without module info. This is a known issue (google/go-licenses#128) but doesn't affect our ability to scan third-party dependencies. Changes: - Allow go-licenses report to fail (|| true) - Filter out Fatal errors (^F) in addition to warnings/errors - Validate we still got valid license data - Exit with error only if no licenses found at all This allows the action to continue and generate reports for third-party dependencies while gracefully handling stdlib package errors.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/README.md (1)
49-49: Fix markdown lint issues for consistency.Line 49 is missing a language specifier for the fenced code block. Lines 96, 99, and 104 use emphasis (
**"..."**) where proper headings (###) would be more appropriate and consistent with markdown conventions.-\`\`\` +\`\`\`text Generating NOTICE file for Atmos...And for the troubleshooting section:
-### Troubleshooting - -**"go-licenses: command not found"** -- The script will auto-install it via `go install` - -**"Failed to find license for X"** -- Some packages have non-standard license file names -- Check the package manually and add to ignore list if needed -- See `go-licenses` documentation for `--ignore` flag - -**"One or more libraries have incompatible/unknown license"** -- This warning can be ignored for known cases (xi2/xz is public domain) -- Review unknown licenses manually before proceeding +### Troubleshooting + +#### go-licenses: command not found +The script will auto-install it via `go install` + +#### Failed to find license for X +Some packages have non-standard license file names. Check the package manually and add to ignore list if needed. See `go-licenses` documentation for `--ignore` flag. + +#### One or more libraries have incompatible/unknown license +This warning can be ignored for known cases (xi2/xz is public domain). Review unknown licenses manually before proceeding.Also applies to: 96-96, 99-99, 104-104
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
.github/actions/license-check/README.md(1 hunks).github/actions/license-check/action.yml(1 hunks).github/workflows/license-check.yml(1 hunks)NOTICE(1 hunks)scripts/README.md(1 hunks)scripts/generate-notice.sh(1 hunks)
🧰 Additional context used
🪛 LanguageTool
.github/actions/license-check/README.md
[uncategorized] ~114-~114: The official name of this software platform is spelled with a capital “H”.
Context: ... NOTICE file. ## Example Workflow See [.github/workflows/license-check.yml](../../wor...
(GITHUB)
[typographical] ~123-~123: Consider using a typographic opening quote here.
Context: ...s as artifacts ## Troubleshooting ### "Unknown licenses detected" Some depende...
(EN_QUOTES)
[typographical] ~123-~123: Consider using a typographic close quote here.
Context: ...shooting ### "Unknown licenses detected" Some dependencies may have non-standar...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic opening quote here.
Context: ...3-Clause (network lookup may fail) ### "NOTICE file is missing" Create a `NOTIC...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic close quote here.
Context: ...p may fail) ### "NOTICE file is missing" Create a NOTICE file in the reposito...
(EN_QUOTES)
scripts/README.md
[uncategorized] ~70-~70: The official name of this software platform is spelled with a capital “H”.
Context: ...with CI/CD The license check workflow (.github/workflows/license-check.yml) verifies ...
(GITHUB)
[typographical] ~96-~96: Consider using a typographic opening quote here.
Context: ... footer message ### Troubleshooting "go-licenses: command not found" - The ...
(EN_QUOTES)
[typographical] ~96-~96: Consider using a typographic close quote here.
Context: ...oting "go-licenses: command not found" - The script will auto-install it via...
(EN_QUOTES)
[typographical] ~99-~99: Consider using a typographic opening quote here.
Context: ...ill auto-install it via go install "Failed to find license for X" - Some p...
(EN_QUOTES)
[typographical] ~99-~99: Consider using a typographic close quote here.
Context: ...nstall` "Failed to find license for X" - Some packages have non-standard lic...
(EN_QUOTES)
[typographical] ~104-~104: Consider using a typographic opening quote here.
Context: ...sdocumentation for--ignore` flag **"One or more libraries have incompatible/...
(EN_QUOTES)
🪛 markdownlint-cli2 (0.18.1)
scripts/README.md
49-49: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
96-96: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
99-99: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
104-104: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Build (windows)
- GitHub Check: Run pre-commit hooks
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Check for changelog entry
- GitHub Check: Check License Attributions
- GitHub Check: autofix
- GitHub Check: Summary
🔇 Additional comments (7)
.github/actions/license-check/README.md (1)
1-143: Documentation is clear and comprehensive. The README effectively explains the action's purpose, features, usage patterns, inputs/outputs, and troubleshooting guidance. Good job breaking down license types and providing actionable error messages.Consider addressing the LanguageTool hints for typographic quotes if your project follows formal documentation standards, though the current quotes are functional.
NOTICE (1)
765-768: Investigate missing license URL for inet.af/netaddr.Line 767 shows
URL: Unknownfor this dependency. While the action won't fail on this, consider manually verifying the license information and updating the URL or runninggenerate-notice.shto see if the tool can find it..github/workflows/license-check.yml (1)
1-43: Workflow consolidation looks solid. Good choices on triggering (PR changes, push to main, weekly schedule, manual dispatch) and path filters. The permissions are appropriately scoped to read contents and write PR comments. Weekly schedule is helpful for catching transitive dependency license changes.scripts/generate-notice.sh (1)
1-148: Script is well-structured with solid error handling. Good use ofset -euo pipefail, proper temporary file cleanup, and auto-installation ofgo-licenses. The filtering of warnings/errors (lines 30-35) and optional sections for MPL-2.0 and MIT are thoughtful touches. The CSV parsing correctly adapts for Apache-2.0 (hardcoded) vs. BSD variants (extracted from column 3)..github/actions/license-check/action.yml (3)
71-183: Overall action logic is well-structured. The flow—setup Go, check for disallowed licenses, generate reports, analyze attribution requirements, check NOTICE completeness, detect missing attributions, and generate summaries—is sound. The missing attribution detection (lines 145-154) correctly identifies gaps by comparing required dependencies against NOTICE entries and provides copy-paste-friendly text for the PR comment. Good defensive use of|| truefor non-fatal failures.Once you fix the markdown pollution issue above, this action will be solid.
202-260: PR commenting logic is clean. The script correctly finds and updates existing bot comments to avoid duplicates, or creates a new comment if none exists. The summary is user-friendly and includes actionable next steps (add entries to NOTICE or rungenerate-notice.sh).
145-183: Missing attribution detection is thorough. The comparison logic (usingcomm -23to find entries in required dependencies but not in NOTICE) is solid. Extracting package names withsed 's/^ - //'correctly parses the NOTICE format, and the output includes the formatted text ready to copy-paste into the NOTICE file.Verify that
missing-deps.txthandles edge cases (empty lines, special characters in package names) gracefully. If packages have unusual names, the sed pattern might need adjustment.
- Add grep -v "^F" to all license-report-full.log processing - Prevents Fatal error lines from corrupting counts and GitHub Actions outputs - Fixes "Invalid format" error in GitHub Actions output - Ensures consistent filtering across all grep commands
- Fix heredoc in generate-notice.sh to not add blank line before EOF - Regenerate NOTICE file with correct single trailing newline - Fixes pre-commit hook end-of-file-fixer check
- Replace shell variable assignments with human-readable text - Change 'attribution_count=N' to 'Attribution-required dependencies: N' - Change 'unknown_count=N' to 'Unknown-license dependencies: N' - Keeps GitHub Actions outputs unchanged for automation
- Replace '|| echo "0"' with '|| true' for grep -c commands - grep -c already outputs '0' when no matches found, but returns exit code 1 - The '|| echo "0"' was appending a second '0', creating "0\n0" in variables - This caused GitHub Actions 'Invalid format' errors in outputs - Affects ATTRIBUTION_COUNT and UNKNOWN_COUNT variables
## What Changed - **Removed** custom .github/actions/license-check/ action (264 lines of brittle bash) - **Removed** custom .github/workflows/license-check.yml workflow (44 lines) - **Added** GitHub's native dependency-review-action workflow - **Updated** scripts/README.md to document new approach ## Why This Is Better **Reliability:** - No more fighting with go-licenses stdlib errors (issue #128) - No more grep -c edge cases with duplicate zeros - No more GitHub Actions output format errors - GitHub's license data from ClearlyDefined (industry standard) **Simplicity:** - 18 lines of workflow vs 308 lines of custom code - Zero maintenance burden - GitHub maintains the action - Works across all ecosystems, not just Go **Functionality:** - Still validates licenses on every PR - Still blocks copyleft/restrictive licenses (GPL, LGPL, AGPL) - Still checks for security vulnerabilities - Automatically comments on PRs with details ## NOTICE File Generation The NOTICE file remains in the repository and is updated manually using: ```bash ./scripts/generate-notice.sh ``` This is intentional to: - Allow human review of license changes - Keep file stable across builds - Separate validation (automated) from documentation (manual) ## Migration Notes License compliance is now enforced by GitHub's native dependency graph rather than running go-licenses in CI. This is more reliable and requires zero custom code to maintain.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
## What Changed Added `actions/go-dependency-submission@v2` action to submit Go dependencies to GitHub's dependency graph before running dependency-review-action. ## Why The dependency-review-action only detected workflow files (actions/checkout, etc) and not the actual Go dependencies from go.mod because: 1. GitHub's dependency graph needs build-time detection for Go modules 2. The `go-dependency-submission` action resolves transitive dependencies 3. This provides accurate license detection for all 405 Go dependencies ## How It Works 1. **go-dependency-submission** job: - Analyzes go.mod and resolves all dependencies - Submits complete dependency tree to GitHub's dependency graph 2. **dependency-review** job: - Waits for dependency submission to complete - Reviews all Go dependencies for license compliance - Comments on PR if issues found ## References - https://github.com/actions/go-dependency-submission - https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
…mission) ## What Changed Removed the `go-dependency-submission` job that was failing and returned to the simple dependency-review-action workflow. ## Why This Is Correct The dependency-review-action **already works with Go modules** by: 1. Detecting go.mod changes automatically via GitHub's dependency graph 2. Reviewing dependency **changes** between base and PR branches 3. Commenting on PRs when new/changed dependencies have license issues ## Why This PR Shows No Go Dependencies This PR only changes: - Workflow files (.github/workflows/) - NOTICE file (documentation) - Scripts (scripts/) **It doesn't modify go.mod or go.sum**, so there are no Go dependency changes to review. The action correctly scanned the workflow dependencies (actions/checkout, actions/dependency-review-action) and found no issues. ## Testing the Go License Checking To test Go license detection, a PR would need to: 1. Add/update a dependency in go.mod (e.g., `go get some/package`) 2. The action will detect the new dependency 3. If it has a denied license (GPL/LGPL/AGPL), the check will fail 4. A comment will be posted with details ## Recommendation Keep this simple workflow. It correctly handles: - ✅ Go module license compliance (on go.mod changes) - ✅ Workflow dependency compliance (actions) - ✅ Security vulnerability detection - ✅ Zero maintenance burden
- dependency-review.yml: Validate NOTICE is up-to-date on PRs - autofix.yml: Auto-generate and commit NOTICE when dependencies change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Previously only ran when go.mod/go.sum changed, but we want it to run on all PRs to ensure NOTICE file stays up-to-date. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Includes fixes for PR checkout issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
The autofix-ci action needs read access to upload artifacts and interact with the GitHub API. Without this permission, artifact uploads fail with JSON parsing errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
scripts/README.md (2)
49-49: Specify language identifier on the code block.The example output block should declare its language to improve formatting and syntax highlighting.
-``` +```bash Generating NOTICE file for Atmos...
92-102: Use heading syntax instead of emphasis for subsection labels.Lines 92, 95, and 100 use bold emphasis (
**text**) for troubleshooting items; consider using proper Markdown headings (#### text) for consistency and better semantic structure.### Troubleshooting -**"go-licenses: command not found"** +#### "go-licenses: command not found" - The script will auto-install it via `go install` -**"Failed to find license for X"** +#### "Failed to find license for X" - Some packages have non-standard license file names - Check the package manually and add to ignore list if needed - See `go-licenses` documentation for `--ignore` flag -**"One or more libraries have incompatible/unknown license"** +#### "One or more libraries have incompatible/unknown license" - This warning can be ignored for known cases (xi2/xz is public domain) - Review unknown licenses manually before proceeding
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
.github/workflows/autofix.yml(3 hunks).github/workflows/dependency-review.yml(1 hunks).github/workflows/license-check.yml(0 hunks)scripts/README.md(1 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/license-check.yml
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: aknysh
PR: cloudposse/atmos#944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
🪛 LanguageTool
scripts/README.md
[typographical] ~92-~92: Consider using a typographic opening quote here.
Context: ... footer message ### Troubleshooting "go-licenses: command not found" - The ...
(EN_QUOTES)
[typographical] ~92-~92: Consider using a typographic close quote here.
Context: ...oting "go-licenses: command not found" - The script will auto-install it via...
(EN_QUOTES)
[typographical] ~95-~95: Consider using a typographic opening quote here.
Context: ...ill auto-install it via go install "Failed to find license for X" - Some p...
(EN_QUOTES)
[typographical] ~95-~95: Consider using a typographic close quote here.
Context: ...nstall` "Failed to find license for X" - Some packages have non-standard lic...
(EN_QUOTES)
[typographical] ~100-~100: Consider using a typographic opening quote here.
Context: ...sdocumentation for--ignore` flag **"One or more libraries have incompatible/...
(EN_QUOTES)
🪛 markdownlint-cli2 (0.18.1)
scripts/README.md
49-49: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
92-92: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
95-95: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
100-100: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build (windows)
- GitHub Check: Run pre-commit hooks
- GitHub Check: Analyze (go)
- GitHub Check: autofix
- GitHub Check: Lint (golangci)
- GitHub Check: Review Dependency Licenses
- GitHub Check: Summary
🔇 Additional comments (4)
.github/workflows/dependency-review.yml (2)
25-39: License deny-list is well-structured and appropriate.The comprehensive copyleft and restrictive license filtering aligns with industry-standard compliance practices. The fail-on-severity level and PR commenting provide clear developer feedback.
41-48: Validate NOTICE generation robustness and clarify duplication across workflows.The script is called here and also in autofix.yml (line 65). Two considerations:
Robustness: Ensure
./scripts/generate-notice.shhandles failures gracefully (e.g., ifgo-licensesis unavailable or network calls fail). The error message on line 47 is helpful but won't be reached if the script silently fails.Duplication: Confirm whether running
generate-notice.shin both workflows is intentional or if it should run in only one place to avoid redundant work..github/workflows/autofix.yml (2)
7-8: Permissions addition looks correct, but verify no unintended side effects.Changing from unspecified (permissive) to explicit
contents: readis the right move for least-privilege. However, confirm that:
- The autofix-ci action (line 67) doesn't rely on implicit elevated permissions
- The overall job behavior remains unchanged (especially for private runners with custom tags)
Also applies to: 17-18
63-65: NOTICE generation step placement and dependency are well-reasoned.Running
generate-notice.shafter pre-commit fixes but before autofix-ci ensures the artifact is ready. The step comment explains intent clearly. Just confirm the script exists and is executable at that path.
The autofix-ci action may need actions:write permission for artifact uploads to work properly with GitHub's API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
RunsOn requires the runs-on/action@v2 step when using extras=s3-cache with actions/upload-artifact. Without this action, artifact uploads fail with JSON parsing errors because the S3 cache backend is not properly configured. See: https://runs-on.com/features/s3-cache-for-github-actions/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
These changes were released in v1.196.0-rc.0. |
what
dependency-review-actiongo-licenseswhy
go-licensesbugsreferences
.github/actions/license-check/(264 lines) and custom workflow (44 lines)Troubleshooting Notes
autofix.ci Artifact Upload Errors (RESOLVED)
Error encountered:
Root Cause:
When using RunsOn self-hosted runners with
extras=s3-cache, theruns-on/action@v2step is required for artifact uploads to work. Without it, the artifact API receives HTML error pages instead of JSON responses.Fix Applied:
runs-on/action@v2as first step in autofix.yml (required for S3 cache compatibility)permissions: { contents: read, actions: write }(was empty{}which grants NO permissions)Reference:
s3-cacheextra and are using theactions/upload-artifact@v4action in your workflows, you must ensure that you have also included theruns-on/action@v2action in your jobs."Time saved for future developers: ~2 hours of debugging 🎯
Summary by CodeRabbit
New Features
Documentation