Skip to content

ci(license): add license header check for .rs files - #20

Open
riccardo-negri wants to merge 1 commit into
network-analytics:mainfrom
riccardo-negri:add-license-check
Open

ci(license): add license header check for .rs files#20
riccardo-negri wants to merge 1 commit into
network-analytics:mainfrom
riccardo-negri:add-license-check

Conversation

@riccardo-negri

Copy link
Copy Markdown
Member

No description provided.

@riccardo-negri riccardo-negri self-assigned this Jul 30, 2026
@riccardo-negri
riccardo-negri enabled auto-merge (rebase) July 30, 2026 13:53
@riccardo-negri
riccardo-negri marked this pull request as draft July 30, 2026 14:00
auto-merge was automatically disabled July 30, 2026 14:00

Pull request was converted to draft

@riccardo-negri

Copy link
Copy Markdown
Member Author

@riccardo-negri
riccardo-negri marked this pull request as ready for review July 30, 2026 14:13
@riccardo-negri
riccardo-negri enabled auto-merge (rebase) July 30, 2026 14:14
@rodonile
rodonile requested a review from Copilot July 30, 2026 14:30

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

Adds a CI guardrail to enforce Apache 2.0 license headers on Rust files touched in pull requests, with additional rules around preserving legacy NetGauze attribution when present.

Changes:

  • Introduces a new license job in CI to run only on pull_request events and validate headers on changed *.rs files.
  • Adds .github/scripts/check_license.py to validate the required header format and ensure NetGauze attribution lines aren’t removed when they existed in the base ref.

Reviewed changes

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

File Description
.github/workflows/ci.yml Adds a PR-only job that identifies changed Rust files and runs the license checker.
.github/scripts/check_license.py Implements header validation and base-ref comparison logic for NetGauze attribution preservation.

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

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/scripts/check_license.py Outdated
Comment thread .github/scripts/check_license.py Outdated
@riccardo-negri

Copy link
Copy Markdown
Member Author

rodonile
rodonile previously approved these changes Jul 30, 2026
@rodonile
rodonile force-pushed the add-license-check branch from 136b1db to 7fe4f58 Compare July 31, 2026 07:06

@ustorbeck ustorbeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • When a file is renamed or copied and substantially rewritten git will detect it as a new file and the license check will fail with "new file must not have a NetGauze Authors copyright line" which it should not. Either reduce the similarity threshold for git or maybe drop the check for the NetGauze header in new files.
  • The script uses git porcelain commands (git show, git diff) where the output format is not guaranteed to be stable. Better use git plumbing commands like git cat-file instead.

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/scripts/check_license.py Outdated
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.

4 participants