Skip to content

Commit fd54a9b

Browse files
committed
refactor: ♻️ LICENSE only checked at root repository to comply with GitHub API fetching spdx id
1 parent 9472ff5 commit fd54a9b

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

bot/compliance-checks/license/index.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ const CODEFAIR_DOMAIN = process.env.CODEFAIR_APP_DOMAIN;
1818
*/
1919
export async function checkForLicense(context, owner, repoName) {
2020
const licenseFilesTypes = [
21+
"LICENSE",
2122
"LICENSE.md",
2223
"LICENSE.txt",
23-
"LICENSE",
24-
"docs/LICENSE.md",
25-
"docs/LICENSE.txt",
26-
"docs/LICENSE",
27-
".github/LICENSE.md",
28-
".github/LICENSE.txt",
29-
".github/LICENSE",
3024
];
3125

3226
for (const filePath of licenseFilesTypes) {
@@ -79,7 +73,7 @@ export function validateLicense(license, existingLicense) {
7973

8074
// Check for specific license conditions
8175
if (licenseId === "no-license" || !licenseId) {
82-
logwatch.info(`No license or 'no-license' found for repo: ${repoName}`);
76+
logwatch.info(`No license or 'no-license' found`);
8377
licenseId = null;
8478
licenseContent = "";
8579
licenseContentEmpty = true;
@@ -88,18 +82,14 @@ export function validateLicense(license, existingLicense) {
8882
if (licenseId === "NOASSERTION") {
8983
if (licenseContentEmpty) {
9084
// No assertion and no content indicates no valid license
91-
logwatch.info(
92-
`No assertion ID with no content provided for repo: ${repoName}`
93-
);
85+
logwatch.info(`No assertion ID with no content provided`);
9486
licenseId = null;
9587
} else {
9688
// Custom license with content provided
9789
licenseContentEmpty = false;
9890
if (existingLicense?.license_content.trim() !== licenseContent.trim()) {
9991
licenseId = "Custom"; // New custom license
100-
logwatch.info(
101-
`Custom license with new content provided for repo: ${repoName}`
102-
);
92+
logwatch.info(`Custom license with new content provided`);
10393
} else if (existingLicense?.license_id) {
10494
licenseId = existingLicense.license_id; // Use existing custom license ID
10595
logwatch.info("Custom license with existing content provided");

0 commit comments

Comments
 (0)