Skip to content

ci: add license scan workflow#1341

Merged
tj098895 merged 7 commits into
mainfrom
ci/license-scan
Jan 30, 2026
Merged

ci: add license scan workflow#1341
tj098895 merged 7 commits into
mainfrom
ci/license-scan

Conversation

@Aleksander-Karlsson
Copy link
Copy Markdown
Contributor

@Aleksander-Karlsson Aleksander-Karlsson commented Jan 23, 2026

Type of Work

  • Patch: X.Y.Z+1. NEGLIGIBLE visible changes, does not change input or output - OR changes behaviour. Use chore:, refactor: etc
  • Minor: X.Y+1.Z. Minor changes, might ADD new input (YAML), or other backwards-compatible changes. Use feat:, fix:
  • Major: X+1.Y.Z. Major and most likely BREAKING changes, wo. backwards compatibility, or removing temporary backwards compatibility functionality. Use ! or BREAKING:.

See here (internal): https://github.com/equinor/ecalc-internal/discussions/1044

Have you remembered and considered?

  • IF FEAT: I have remembered to update documentation
  • IF FIX OR FEAT: I have remembered to update manual changelog (docs/drafts/next.draft.md)
  • IF BREAKING: I have remembered to update migration guide (docs/docs/migration_guides/)
  • IF BREAKING: I have committed with BREAKING: in footer or ! in header
  • I have added tests (if not, comment why)
  • I have used conventional commits syntax (if you squash, make sure that conventional commit is used)
  • I have included the Github issue nr in the footer!

What is this PR all about?

What else did you consider?

I think this action will also check if added deps have security-issues. The default threshold for criticality is "low". I'm not sure the what extent that will impact development, so I have left it untouched for now. With the caveat that it can be adjusted if needed.

Another point is which licenses to allow (note, deny-list is deprecated, so we can only specify the allow-list). I've added some I think should be good, but I've not delved deep into the actual contents of each license so the list may be both wrong and incomplete.
I hope this PR can be the start to fint out what to allow!

Between the lines?

close: https://github.com/equinor/ecalc-internal/issues/1442
close: https://github.com/equinor/ecalc-internal/issues/1238

Comment thread .github/workflows/license-scan.yml Outdated
Comment thread .github/workflows/license-scan.yml Outdated
"MPL-2.0",
"WTFPL"

# All SPDX-compliant identifiers https://spdx.org/licenses/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for reference or did you intend to remove this list on merge? it will change nevertheless, but very useful to allow-list licenses :)

what about if a package is detected without a license or has several licenses? will we be notified about that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I plan to remove all the unused licenses yeah, keeping them around for convenience until we have a good allowlist :)

Not sure what happens with several licenses, will look into that. I would be fairly sure that no license would not be a part of our allowed licenses, but I will also double check that!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On the point of Others, according to GitHub docs https://github.com/actions/dependency-review-action#other-in-license-strings:

OTHER in license strings
License data comes from ClearlyDefined and you may sometimes see licenses displayed with the string OTHER in them. ClearlyDefined defines OTHER as:
This indicates that a human confirmed that there is license information in the file but that the license is not an SPDX-identified license.
OTHER is not a valid SPDX license identifier, so we convert OTHER in a license string into LicenseRef-clearlydefined-OTHER, which is valid in SPDX. If you want to add that to the deny or allow list, be sure to add LicenseRef-clearlydefined-OTHER to this list, because that is what we'll actually be comparing.

Then for some reason they also have this as a note:

If we can't detect the license for a dependency we will inform you, but the action won't fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When multiple licenses are present I suspect it should handle each individually, tho I'm not sure. I see that the actions supports SPDX compliant license naming, and those support some boolean algebra like:
SPDX-License-Identifier: Apache-2.0 AND (MIT OR GPL-2.0-only)

But GitHub make no mention of whether or not the action handles such cases. Guess I'll have to look into the source code or test it manually somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added custom step in the action actually blocking if a dependency ha no or unknown license.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems like the action handles AND's & OR's :)

allow = allow?.filter(license => {
    return !license.includes(' AND ') && !license.includes(' OR ')
  })

Comment thread .github/workflows/license-scan.yml Outdated
"BSD-1-Clause",
"BSD-2-Clause",
"BSD-3-Clause",
"LGPL-2.0-only",
Copy link
Copy Markdown
Contributor

@tj098895 tj098895 Jan 26, 2026

Choose a reason for hiding this comment

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

is lgpl 2 compatible with lgpl 3? you are a bit more familiar with licenses than me, so is that relevant to consider?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it relevant to block list those that we KNOW are incompatible? and then we iterate as we go?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are 100% correct! LGPL-2.O-only is not compatible, will remove it!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Revised the list! I added some rationale. But I would really like some form of review of the decisions here to the degree that it's possible. I am in no way an expert on licenses or copyright law.

@Aleksander-Karlsson Aleksander-Karlsson marked this pull request as ready for review January 29, 2026 14:23
@Aleksander-Karlsson Aleksander-Karlsson requested a review from a team as a code owner January 29, 2026 14:23
Comment thread .github/workflows/license-scan.yml Outdated
"BSD-1-Clause",
"BSD-2-Clause",
"BSD-3-Clause",
"LGPL-2.0-only",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it relevant to block list those that we KNOW are incompatible? and then we iterate as we go?

Comment thread .github/workflows/license-scan.yml Outdated
@tj098895 tj098895 merged commit bf36360 into main Jan 30, 2026
23 checks passed
@tj098895 tj098895 deleted the ci/license-scan branch January 30, 2026 11:54
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.

2 participants