Skip to content

Scripts: Recognize GPLv3 as compatible in check-licenses - #80263

Open
amoljadhavminiorange wants to merge 1 commit into
WordPress:trunkfrom
amoljadhavminiorange:fix/20701-check-licenses-gplv3
Open

Scripts: Recognize GPLv3 as compatible in check-licenses#80263
amoljadhavminiorange wants to merge 1 commit into
WordPress:trunkfrom
amoljadhavminiorange:fix/20701-check-licenses-gplv3

Conversation

@amoljadhavminiorange

Copy link
Copy Markdown

Fixes #20701

What?

Adds the GPLv3 license identifiers (GPL-3.0, GPL-3.0-only, GPL-3.0-or-later) to the otherOssLicenses list in check-licenses, so dependencies under those licenses are accepted when the --gpl2 flag is not passed. Strict GPLv2 mode (--gpl2) continues to reject them.

Why?

As reported in #20701, wp-scripts check-licenses currently errors on GPL-3.0-or-later dependencies even in default mode. Since WordPress is distributed under "GPLv2 or later", GPLv3-licensed code can be combined with it. This implements the approach proposed by @pento in #20701 (comment): add GPLv3 to otherOssLicenses, and be more explicit in the readme that check-licenses is a WordPress-specific tool.

Note: I'm aware of the warning comment in license.js that changes to the license lists need explicit review — flagging that this PR is exactly such a change. The deprecated SPDX identifier GPL-3.0 is included alongside the two modern ones because older packages still declare it; happy to drop it if preferred.

How?

  • packages/scripts/utils/license.js: three GPLv3 identifiers added to otherOssLicenses (kept alphabetical).
  • packages/scripts/README.md: the check-licenses section now explains the tool is WordPress-specific, why GPLv3 is accepted by default, and that --gpl2 restricts to strict GPLv2 compatibility.
  • packages/scripts/utils/test/license.js: new getLicenses() tests covering both modes (also converted the internal import to require to satisfy the strict import/order pre-commit lint).
  • packages/scripts/CHANGELOG.md: entry under Unreleased.

Testing Instructions

  1. npx jest packages/scripts/utils/test/license.js --config=test/unit/jest.config.js — 12 tests pass.
  2. Functional check: in a temp project with a dependency whose package.json declares "license": "GPL-3.0-or-later":
    • wp-scripts check-licenses → passes (exit 0). Before this change it errored with Module <dep> has an incompatible license 'GPL-3.0-or-later'.
    • wp-scripts check-licenses --gpl2 → still fails as expected.

Add GPL-3.0, GPL-3.0-only and GPL-3.0-or-later to the list of licenses
that check-licenses accepts when the --gpl2 flag is not passed. Since
WordPress is distributed under GPLv2 or later, GPLv3 dependencies can
be combined with it, while strict GPLv2 mode continues to reject them.

Also document in the readme that check-licenses is a WordPress-specific
tool, and add unit tests covering getLicenses in both modes.

Fixes WordPress#20701.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @ntwb.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: ntwb.

Co-authored-by: amoljadhavminiorange <amoljadhavminiorange@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>
Co-authored-by: pento <pento@git.wordpress.org>
Co-authored-by: ryanwelcher <welcher@git.wordpress.org>
Co-authored-by: cliffordp <cliffpaulick@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @amoljadhavminiorange! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 14, 2026
@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: First-time Contributor.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@amoljadhavminiorange

Copy link
Copy Markdown
Author

All CI checks pass except type-related-labels, which needs a type label — could a maintainer please add [Type] Enhancement? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check-licenses: GPLv3 isn't recognized as a compatible license

1 participant