Skip to content

Commit cb34fec

Browse files
committed
fix: ignore hidden files in skill publish package
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
1 parent fa4459f commit cb34fec

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/actions/skills-publish/entrypoint.mjs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,38 @@ const resolveRole = (filePath) => {
9999
return 'file';
100100
};
101101

102+
const BLOCKED_PATH_SEGMENTS = new Set([
103+
'.git',
104+
'.github',
105+
'node_modules',
106+
'.next',
107+
'dist',
108+
'build',
109+
'coverage',
110+
]);
111+
112+
const shouldSkipPath = (relativePath) => {
113+
const segments = String(relativePath ?? '')
114+
.split('/')
115+
.map((segment) => segment.trim())
116+
.filter(Boolean);
117+
return segments.some(
118+
(segment) => BLOCKED_PATH_SEGMENTS.has(segment) || segment.startsWith('.'),
119+
);
120+
};
121+
102122
const walkFiles = async (rootDir, relativeDir = '') => {
103123
const fullDir = relativeDir ? path.join(rootDir, relativeDir) : rootDir;
104124
const entries = await readdir(fullDir, { withFileTypes: true });
105125
const files = [];
106126

107127
for (const entry of entries) {
108-
if (entry.name === '.git') {
109-
continue;
110-
}
111128
const childRelative = relativeDir
112129
? path.posix.join(relativeDir, entry.name)
113130
: entry.name;
131+
if (shouldSkipPath(childRelative)) {
132+
continue;
133+
}
114134
const childFullPath = path.join(rootDir, childRelative);
115135
if (entry.isDirectory()) {
116136
const nested = await walkFiles(rootDir, childRelative);

0 commit comments

Comments
 (0)