Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove keywords if they're not present #2474

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions utils/__tests__/validate_icon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.mock('fs');

describe('validate Icon tests', () => {
afterEach(() => {
jest.restoreAllMocks();
jest.resetAllMocks();
});

describe('validateIcon', () => {
Expand Down Expand Up @@ -130,7 +130,6 @@ describe('validate Icon tests', () => {
expect(logMock).toHaveBeenCalledWith(
'No errors found. Icon validation passed.'
);
expect(process.exitCode).toBe(undefined);
});

test('when given errors, prints each error and sets exitCode to 1', () => {
Expand All @@ -139,7 +138,6 @@ describe('validate Icon tests', () => {
handleErrors(['error1', 'error2', 'error3', 'error4']);

expect(logMock).toBeCalledTimes(4);
expect(process.exitCode).toBe(1);
});
});
});
2 changes: 1 addition & 1 deletion utils/lib/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class DataSource extends Component<DataSourceConfig, string> {
icon: this._getIconUrl(),
install: this._parseInstall(),
categoryTerms: categoryTerms && categoryTerms.map((t) => t.trim()),
keywords: keywords && keywords.map((k) => k.trim()),
keywords: keywords ? keywords.map((k) => k.trim()) : [],
aswanson-nr marked this conversation as resolved.
Show resolved Hide resolved
description: description && description.trim(),
};

Expand Down
6 changes: 4 additions & 2 deletions utils/validate_icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export const handleErrors = (
}

if (errorMessages.length > 0) {
process.exitCode = 1; // fail the workflow

for (const errorMessage of errorMessages) {
console.log(errorMessage);
}
Expand All @@ -58,6 +56,10 @@ const main = () => {
var errorMessages: string[] = validateIcon(mainConfigPaths);
handleErrors(errorMessages);
console.log(''); // add an extra new line for more visual separation in the workflow

if(errorMessages.length) {
process.exit(1);
}
};

/**
Expand Down
Loading