Skip to content

Commit

Permalink
ci(pull-request): Fix generate comments for empty changes (#2593)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfennis authored Nov 8, 2024
1 parent d2f7a09 commit d30698c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Empty file added comment-markup.md
Empty file.
10 changes: 10 additions & 0 deletions scripts/generateChangedIconsCommentMarkup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ const BASE_URL = 'https://lucide.dev/api/gh-icon';

const changedFilesPathString = process.env.CHANGED_FILES;

if (changedFilesPathString == null) {
console.error('CHANGED_FILES env variable is not set');
process.exit(1);
}

const changedFiles = changedFilesPathString
.split(' ')
.map((file) => file.replace('.json', '.svg'))
.filter((file, idx, arr) => arr.indexOf(file) === idx);

if (changedFiles.length === 0) {
console.log('No changed icons found');
process.exit(0);
}

const getImageTagsByFiles = (files, getBaseUrl, width) =>
files.map((file) => {
const svgContent = fs.readFileSync(path.join(process.cwd(), file), 'utf-8');
Expand Down

0 comments on commit d30698c

Please sign in to comment.