@@ -246,6 +246,26 @@ const NpmInstallStep: NpmStep = {
246246 run : async ( ctx , params ) => {
247247 const repo = eventRepo ( ctx . data ) ;
248248 const commit = eventCommit ( ctx . data ) ;
249+
250+ // add /.npm/ to the .npmignore file
251+ const npmIgnore = params . project . path ( ".npmignore" ) ;
252+ try {
253+ if ( await fs . pathExists ( npmIgnore ) ) {
254+ const npmIgnoreContent = await fs . readFile ( npmIgnore , "utf8" ) ;
255+ await fs . writeFile ( npmIgnore , `${ npmIgnoreContent } \n/.npm/` ) ;
256+ } else {
257+ await fs . writeFile ( npmIgnore , "/.npm/" ) ;
258+ }
259+ } catch ( e ) {
260+ const reason = `Failed to update .npmignore: ${ e . message } ` ;
261+ params . body . push ( reason ) ;
262+ await params . check . update ( {
263+ conclusion : "failure" ,
264+ body : params . body . join ( "\n\n---\n\n" ) ,
265+ } ) ;
266+ return status . failure ( statusReason ( { reason, commit, repo } ) ) ;
267+ }
268+
249269 const opts = {
250270 env : {
251271 ...process . env ,
@@ -528,25 +548,6 @@ const NpmPublishStep: NpmStep = {
528548 const tag = eventTag ( ctx . data ) ;
529549 const pj = await fs . readJson ( params . project . path ( "package.json" ) ) ;
530550
531- // add /.npm/ to the .npmignore file
532- const npmIgnore = params . project . path ( ".npmignore" ) ;
533- try {
534- if ( await fs . pathExists ( npmIgnore ) ) {
535- const npmIgnoreContent = await fs . readFile ( npmIgnore , "utf8" ) ;
536- await fs . writeFile ( npmIgnore , `${ npmIgnoreContent } \n/.npm/` ) ;
537- } else {
538- await fs . writeFile ( npmIgnore , "/.npm/" ) ;
539- }
540- } catch ( e ) {
541- const reason = `Failed to update .npmignore: ${ e . message } ` ;
542- params . body . push ( reason ) ;
543- await params . check . update ( {
544- conclusion : "failure" ,
545- body : params . body . join ( "\n\n---\n\n" ) ,
546- } ) ;
547- return status . failure ( statusReason ( { reason, commit, repo } ) ) ;
548- }
549-
550551 const args = [ ] ;
551552 if ( cfg . access ) {
552553 args . push ( "--access" , cfg . access ) ;
0 commit comments