ci(pull-request): Fix generate comments for empty changes (#2593)

This commit is contained in:
Eric Fennis
2024-11-08 16:00:23 +01:00
committed by GitHub
parent d2f7a0931d
commit d30698cb38
2 changed files with 10 additions and 0 deletions

0
comment-markup.md Normal file
View File

View File

@@ -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');