Create and enforce open source license policies to control which licenses your dependencies are allowed to use.
Before you configure license policies, ensure that:
Open source license compliance lets you define a policy that specifies which licenses your dependencies are allowed to use.
When the policy is enforced with rulesets, GitHub evaluates pull requests that change package manifests, checks direct and transitive dependencies, and compares detected licenses to your policy. Pull requests with noncompliant dependencies remain blocked until violations are resolved.
Violations are typically resolved by:
Alternately, if you have an existing license policy from another tool, you can import it as a list of SPDX expressions.
The licenses you add form your baseline policy. You can later add package-level exceptions when handling alerts.
Assigning this role also subscribes reviewers to request notifications so they can respond to dismissal requests quickly.
If you want a gradual rollout, use a repository custom property to control whether each repository is in inactive, evaluate, or active enforcement mode.
On GitHub, navigate to the main page of the organization.
Under your organization name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

In the sidebar, under "Code, planning, and automation", click Repository, then click Custom properties.

Create a single-select repository custom property, for example open_source_license_compliance.
Add values for inactive, evaluate, and active.
Set the default value to inactive.
Decide who can change the property value.
Assign property values to repositories based on their rollout stage.
We suggest making two rulesets, one for Evaluate mode and one for Active mode. If you created custom properties to control the rollout, you can target those properties here.
Go to the rulesets page for the scope where you want enforcement.
Create a branch ruleset.
Under the ruleset name, set Enforcement status:
Choose how to target repositories:
open_source_license_compliance:
evaluate.active.Enable Require license compliance results before merging.
Save your changes.
For more information about rulesets, see About rulesets and Creating rulesets for repositories in your organization.
If the ruleset is in Active mode, the pull request remains blocked until all license policy violations are resolved.
After a request is approved, the alert is closed and the pull request is unblocked, as long as no other required checks are failing.
On GitHub, navigate to the main page of the repository.
Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

In the sidebar, under "Security", click License policy.
Review the combined policy and exception set in effect for that repository.
Update enterprise-level or repository-level policy as needed.
Package and license entries that are set at the enterprise level will not be editable in the repository policy. Items marked with a indicate repository-level entries which can be deleted.
Changes to the license policy emit events to the audit log. These events are useful to review the history of changes or to feed external systems for compliance purposes. The log events are categorized as Policy Management, with a prefix of license_compliance_policy. They will have an action type create or modify. For details about the contents of the audit log events, see Audit log events for your organization.
There are several REST API endpoints for managing license compliance policy. You can use the API to programatically back up and restore your enterprise policy and to query whether a list of packages would create any policy violations if they were included in a repository's dependencies. In addition, operations on license compliance closure requests can generate webhook events when a request is created, receives a response, or is cancelled.
For details about the enterprise policy management API, see REST API endpoints for the dependency graph. For more about the package check API, see REST API endpoints for repositories. For more about webhooks, see Webhook events and payloads.