Skip to content

2.1.15 fix #788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main-enterprise
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/plugins/branches.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ module.exports = class Branches extends ErrorStash {
let p = Object.assign(this.repo, { branch: branch.name })
if (branch.name === 'default') {
p = Object.assign(this.repo, { branch: currentRepo.data.default_branch })
this.log(`Deleting default branch protection for branch ${currentRepo.data.default_branch}`)
this.log.debug(`Deleting default branch protection for branch ${currentRepo.data.default_branch}`)
}
// Hack to handle closures and keep params from changing
const params = Object.assign({}, p)
@@ -43,7 +43,7 @@ module.exports = class Branches extends ErrorStash {
let p = Object.assign(this.repo, { branch: branch.name })
if (branch.name === 'default') {
p = Object.assign(this.repo, { branch: currentRepo.data.default_branch })
// this.log(`Setting default branch protection for branch ${currentRepo.data.default_branch}`)
// this.log.debug(`Setting default branch protection for branch ${currentRepo.data.default_branch}`)
}
// Hack to handle closures and keep params from changing
const params = Object.assign({}, p)
@@ -73,7 +73,7 @@ module.exports = class Branches extends ErrorStash {
return Promise.resolve(resArray)
}
this.log.debug(`Adding branch protection ${JSON.stringify(params)}`)
return this.github.repos.updateBranchProtection(params).then(res => this.log(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] })
return this.github.repos.updateBranchProtection(params).then(res => this.log.debug(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] })
}).catch((e) => {
if (e.status === 404) {
Object.assign(params, branch.protection, { headers: previewHeaders })
@@ -82,7 +82,7 @@ module.exports = class Branches extends ErrorStash {
return Promise.resolve(resArray)
}
this.log.debug(`Adding branch protection ${JSON.stringify(params)}`)
return this.github.repos.updateBranchProtection(params).then(res => this.log(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] })
return this.github.repos.updateBranchProtection(params).then(res => this.log.debug(`Branch protection applied successfully ${JSON.stringify(res.url)}`)).catch(e => { this.logError(`Error applying branch protection ${JSON.stringify(e)}`); return [] })
} else {
this.logError(e)
if (this.nop) {
16 changes: 8 additions & 8 deletions lib/plugins/rulesets.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ module.exports = class Rulesets extends Diffable {
org: this.repo.owner,
headers: version
})
this.log(listOptions)
this.log.debug(listOptions)
return this.github.paginate(listOptions)
.then(res => {
const rulesets = res.map(ruleset => {
@@ -55,7 +55,7 @@ module.exports = class Rulesets extends Diffable {
repo: this.repo.repo,
headers: version
})
this.log(listOptions)
this.log.debug(listOptions)
return this.github.paginate(listOptions)
.then(res => {
const rulesets = res
@@ -102,7 +102,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Updating Ruleset with the following values ${JSON.stringify(parms, null, 2)}`)
return this.github.request('PUT /orgs/{org}/rulesets/{id}', parms).then(res => {
this.log(`Ruleset updated successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset updated successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
return this.handleError(e)
@@ -115,7 +115,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Updating Ruleset with the following values ${JSON.stringify(parms, null, 2)}`)
return this.github.request('PUT /repos/{owner}/{repo}/rulesets/{id}', parms).then(res => {
this.log(`Ruleset updated successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset updated successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
return this.handleError(e)
@@ -132,7 +132,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Creating Rulesets with the following values ${JSON.stringify(attrs, null, 2)}`)
return this.github.request('POST /orgs/{org}/rulesets', this.wrapAttrs(attrs)).then(res => {
this.log(`Ruleset created successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset created successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
return this.handleError(e)
@@ -145,7 +145,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Creating Rulesets with the following values ${JSON.stringify(attrs, null, 2)}`)
return this.github.request('POST /repos/{owner}/{repo}/rulesets', this.wrapAttrs(attrs)).then(res => {
this.log(`Ruleset created successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset created successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
return this.handleError(e)
@@ -163,7 +163,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Deleting Ruleset with the following values ${JSON.stringify(parms, null, 2)}`)
return this.github.request('DELETE /orgs/{org}/rulesets/{id}', parms).then(res => {
this.log(`Ruleset deleted successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset deleted successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
return this.handleError(e)
@@ -176,7 +176,7 @@ module.exports = class Rulesets extends Diffable {
}
this.log.debug(`Deleting Ruleset with the following values ${JSON.stringify(parms, null, 2)}`)
return this.github.request('DELETE /repos/{owner}/{repo}/rulesets/{id}', parms).then(res => {
this.log(`Ruleset deleted successfully ${JSON.stringify(res.url)}`)
this.log.debug(`Ruleset deleted successfully ${JSON.stringify(res.url)}`)
return res
}).catch(e => {
if (e.status === 404) {
6 changes: 3 additions & 3 deletions lib/plugins/validator.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ module.exports = class Validator {
}
}).then(res => {
if (this.repo.repo.search(this.regex) >= 0) {
this.log(`Repo ${this.repo.repo} Passed Validation for pattern ${this.pattern}`)
this.log.debug(`Repo ${this.repo.repo} Passed Validation for pattern ${this.pattern}`)
if (this.nop) {
return Promise.resolve([
new NopCommand(this.constructor.name, this.repo, null, `Passed Validation for pattern ${this.pattern}`)
@@ -38,7 +38,7 @@ module.exports = class Validator {
})
}
} else {
this.log(`Repo ${this.repo.repo} Failed Validation for pattern ${this.pattern}`)
this.log.debug(`Repo ${this.repo.repo} Failed Validation for pattern ${this.pattern}`)
if (this.nop) {
return Promise.resolve([
new NopCommand(this.constructor.name, this.repo, null, `Failed Validation for pattern ${this.pattern}`, 'ERROR')
@@ -59,7 +59,7 @@ module.exports = class Validator {
})
.catch(() => {})
} catch (error) {
this.log(`Error in Validation checking ${error}`)
this.log.debug(`Error in Validation checking ${error}`)
}
}
}