@@ -50,7 +50,7 @@ module.exports = class Repository {
5050 this . topics = this . settings . topics
5151 this . security = this . settings . security
5252 this . repo = repo
53- this . log = log
53+ this . log = log . child ( { context : 'Repository' , repository : this . repo . repo } )
5454 this . nop = nop
5555 this . force_create = this . settings . force_create
5656 this . template = this . settings . template
@@ -82,18 +82,18 @@ module.exports = class Repository {
8282 this . log . debug ( `Result of comparing topics for changes source ${ JSON . stringify ( resp . data . topics ) } target ${ JSON . stringify ( this . topics ) } = ${ topicResults } ` )
8383
8484 if ( this . nop && changes . hasChanges ) {
85- resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `Repo settings changes: ${ results } ` ) )
85+ resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `[ ${ this . settings . name } ] Repo settings changes: ${ results } ` ) )
8686 }
8787 if ( this . nop && topicChanges . hasChanges ) {
88- resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `Repo topics changes ${ topicResults } ` ) )
88+ resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `[ ${ this . settings . name } ] Repo topics changes ${ topicResults } ` ) )
8989 }
9090 const promises = [ ]
9191 if ( changes . hasChanges ) {
9292 this . log . debug ( 'There are repo changes' )
9393 if ( this . settings . default_branch && ( resp . data . default_branch !== this . settings . default_branch ) ) {
9494 this . log . debug ( 'There is a rename of the default branch' )
9595 if ( this . nop ) {
96- resArray . push ( new NopCommand ( 'Repository' , this . repo , this . github . repos . renameBranch . endpoint ( resp . data . default_branch , this . settings . default_branch ) , `Repo rename default branch to ${ this . settings . default_branch } ` ) )
96+ resArray . push ( new NopCommand ( 'Repository' , this . repo , this . github . repos . renameBranch . endpoint ( resp . data . default_branch , this . settings . default_branch ) , `[ ${ this . settings . name } ] Repo rename default branch to ${ this . settings . default_branch } ` ) )
9797 } else {
9898 promises . push ( this . renameBranch ( resp . data . default_branch , this . settings . default_branch ) )
9999 }
@@ -114,7 +114,7 @@ module.exports = class Repository {
114114 } else {
115115 this . log . debug ( `There are no changes for repo ${ JSON . stringify ( this . repo ) } .` )
116116 if ( this . nop ) {
117- resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `There are no changes for repo ${ JSON . stringify ( this . repo ) } .` ) )
117+ resArray . push ( new NopCommand ( 'Repository' , this . repo , null , `[ ${ this . settings . name } ] There are no changes for repo ${ JSON . stringify ( this . repo ) } .` ) )
118118 }
119119 }
120120 if ( this . nop ) {
@@ -126,7 +126,7 @@ module.exports = class Repository {
126126 if ( e . status === 404 ) {
127127 if ( this . force_create ) {
128128 if ( this . template ) {
129- this . log ( `Creating repo using template ${ this . template } ` )
129+ this . log . debug ( `Creating repo using template ${ this . template } ` )
130130 const options = { template_owner : this . repo . owner , template_repo : this . template , owner : this . repo . owner , name : this . repo . repo , private : ( this . settings . private ? this . settings . private : true ) , description : this . settings . description ? this . settings . description : '' }
131131
132132 if ( this . nop ) {
@@ -139,7 +139,7 @@ module.exports = class Repository {
139139 // https://docs.github.com/en/rest/repos/repos#create-an-organization-repository uses org instead of owner like
140140 // the API to create a repo with a template
141141 this . settings . org = this . settings . owner
142- this . log ( 'Creating repo with settings ' , this . settings )
142+ this . log . debug ( 'Creating repo with settings ' , this . settings )
143143 if ( this . nop ) {
144144 this . log . debug ( `Creating Repo ${ JSON . stringify ( this . github . repos . createInOrg . endpoint ( this . settings ) ) } ` )
145145 return Promise . resolve ( [
@@ -162,19 +162,19 @@ module.exports = class Repository {
162162 }
163163
164164 renameBranch ( oldname , newname ) {
165- const parms = {
165+ const params = {
166166 owner : this . settings . owner ,
167167 repo : this . settings . repo ,
168168 branch : oldname ,
169169 new_name : newname
170170 }
171- this . log . debug ( `Rename default branch repo with settings ${ JSON . stringify ( parms ) } ` )
171+ this . log . debug ( `Rename default branch repo with settings ${ JSON . stringify ( params ) } ` )
172172 if ( this . nop ) {
173173 return Promise . resolve ( [
174- new NopCommand ( this . constructor . name , this . repo , this . github . repos . renameBranch . endpoint ( parms ) , 'Rename Branch' )
174+ new NopCommand ( this . constructor . name , this . repo , this . github . repos . renameBranch . endpoint ( params ) , 'Rename Branch' )
175175 ] )
176176 }
177- return this . github . repos . renameBranch ( parms )
177+ return this . github . repos . renameBranch ( params )
178178 }
179179
180180 updaterepo ( resArray ) {
@@ -199,14 +199,14 @@ module.exports = class Repository {
199199 if ( this . topics ) {
200200 if ( repoData . data ?. topics . length !== this . topics . length ||
201201 ! repoData . data ?. topics . every ( t => this . topics . includes ( t ) ) ) {
202- this . log ( `Updating repo with topics ${ this . topics . join ( ',' ) } ` )
202+ this . log . debug ( `Updating repo with topics ${ this . topics . join ( ',' ) } ` )
203203 if ( this . nop ) {
204204 resArray . push ( ( new NopCommand ( this . constructor . name , this . repo , this . github . repos . replaceAllTopics . endpoint ( parms ) , 'Update Topics' ) ) )
205205 return Promise . resolve ( resArray )
206206 }
207207 return this . github . repos . replaceAllTopics ( parms )
208208 } else {
209- this . log ( `no need to update topics for ${ repoData . data . name } ` )
209+ this . log . debug ( `no need to update topics for ${ repoData . data . name } ` )
210210 if ( this . nop ) {
211211 resArray . push ( ( new NopCommand ( this . constructor . name , this . repo , null , `no need to update topics for ${ repoData . data . name } ` ) ) )
212212 return Promise . resolve ( resArray )
@@ -218,9 +218,9 @@ module.exports = class Repository {
218218 // Added support for Code Security and Analysis
219219 updateSecurity ( repoData , resArray ) {
220220 if ( this . security ?. enableVulnerabilityAlerts === true || this . security ?. enableVulnerabilityAlerts === false ) {
221- this . log ( `Found repo with security settings ${ JSON . stringify ( this . security ) } ` )
221+ this . log . debug ( `Found repo with security settings ${ JSON . stringify ( this . security ) } ` )
222222 if ( this . security . enableVulnerabilityAlerts === true ) {
223- this . log ( `Enabling Dependabot alerts for owner: ${ repoData . owner . login } and repo ${ repoData . name } ` )
223+ this . log . debug ( `Enabling Dependabot alerts for owner: ${ repoData . owner . login } and repo ${ repoData . name } ` )
224224 if ( this . nop ) {
225225 resArray . push ( ( new NopCommand ( this . constructor . name , this . repo , this . github . repos . enableVulnerabilityAlerts . endpoint ( {
226226 owner : repoData . owner . login ,
@@ -234,7 +234,7 @@ module.exports = class Repository {
234234 } )
235235 }
236236 else {
237- this . log ( `Disabling Dependabot alerts for for owner: ${ repoData . owner . login } and repo ${ repoData . name } ` )
237+ this . log . debug ( `Disabling Dependabot alerts for for owner: ${ repoData . owner . login } and repo ${ repoData . name } ` )
238238 if ( this . nop ) {
239239 resArray . push ( ( new NopCommand ( this . constructor . name , this . github . repos . disableVulnerabilityAlerts . endpoint ( {
240240 owner : repoData . owner . login ,
@@ -249,7 +249,7 @@ module.exports = class Repository {
249249 }
250250 }
251251 else {
252- this . log ( `no need to update security for ${ repoData . name } ` )
252+ this . log . debug ( `no need to update security for ${ repoData . name } ` )
253253 if ( this . nop ) {
254254 resArray . push ( ( new NopCommand ( this . constructor . name , this . repo , null , `no need to update security for ${ repoData . name } ` ) ) )
255255 return Promise . resolve ( resArray )
@@ -289,4 +289,4 @@ module.exports = class Repository {
289289 }
290290 }
291291 }
292- }
292+ }
0 commit comments