Check Python project dependencies for license compliance using licensecheck.
This action:
- Finds all
pyproject.tomlandrequirements.txtfiles in your project - Runs
licensecheckto validate dependency licenses - Fails if any dependencies have incompatible or unknown licenses
| Input | Description | Required | Default |
|---|---|---|---|
uv-version |
uv version to use | No | 7.1.3 |
licensecheck-version |
licensecheck version to use | No | 2025.1.0 |
skip-dependencies |
Space-separated list of dependencies to skip | No | wrapt (BSD-2-Clause, see issue) |
ignore-licenses |
Space-separated list of license types to ignore | No | MPL |
requirements-paths |
Paths to search for requirements files | No | . |
app-id |
GitHub App ID for accessing private repos | No | "" |
app-private-key |
GitHub App private key for accessing private repos | No | "" |
repository-owner |
Repository owner for GitHub App token | No | Current repo owner |
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check licenses
uses: CVector-Energy/license-check-python@mainAdd the [tool.licensecheck] section to your pyproject.toml to ignore specific dependencies. For example:
[tool.licensecheck]
ignore_packages = ["wrapt"] # BSD-2-Clause license. See https://github.com/GrahamDumpleton/wrapt/issues/298
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check licenses
uses: CVector-Energy/license-check-python@main
with:
ignore-licenses: "MPL BSD-3-Clause"steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check licenses
uses: CVector-Energy/license-check-python@main
with:
requirements-paths: "./backend ./frontend"If your project depends on private packages, you can create a GitHub App and pass its credentials to the action:
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check licenses
uses: CVector-Energy/license-check-python@main
with:
app-id: ${{ vars.APP_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}Your GitHub App should have the repository permission to read contents.
The action will automatically configure git authentication for private repos if the credentials are provided.
If your project depends on private packages from your organization, you'll need to create a GitHub App to grant the action access to those repositories.
- Go to your organization settings:
https://github.com/organizations/YOUR_ORG/settings/apps - Click "New GitHub App"
- Fill in the basic information:
- Name: Something like "License Check" or "CI Private Repo Access"
- Homepage URL: Your organization's homepage or repository URL
- Webhook: Uncheck "Active" (not needed for this use case)
- Under Repository permissions, set:
- Contents: Read-only
- Under Where can this GitHub App be installed?:
- Select "Only on this account"
- Click "Create GitHub App"
- After creating the app, scroll down to "Private keys"
- Click "Generate a private key"
- Save the downloaded
.pemfile securely
- Go to the app's settings page
- Click "Install App" in the left sidebar
- Select your organization
- Choose either:
- All repositories (if you want access to all private repos)
- Only select repositories (choose specific repos)
- Click "Install"
In each repository that needs to use the license check action:
- Go to repository Settings → Secrets and variables → Actions
- Add a new variable:
- Name:
APP_ID - Value: Your GitHub App ID (found on the app's settings page)
- Name:
- Add a new secret:
- Name:
APP_PRIVATE_KEY - Value: The contents of the
.pemfile you downloaded
- Name:
You can also configure these at the organization level to make them available to all repositories.
MIT - See LICENSE for details.