File tree Expand file tree Collapse file tree
.github/actions/skills-publish Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
102122const 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 ) ;
You can’t perform that action at this time.
0 commit comments