GitHub automation: Reduce logging (#12920)

- Smile at the log retention gods
- Plus fix a bug
This commit is contained in:
Mike McNeil 2023-07-22 16:16:17 -05:00 committed by GitHub
parent 55f6f8300b
commit b660c5a222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,7 @@ module.exports = {
let issueOrPr = (pr || issue || undefined);
let ghNoun = this.req.get('X-GitHub-Event');// See https://developer.github.com/v3/activity/events/types/
sails.log(`Received GitHub webhook request: ${ghNoun} :: ${action}: ${require('util').inspect({sender, repository: _.isObject(repository) ? repository.full_name : undefined, comment, label, issueOrPr}, {depth:null})}`);
sails.log.verbose(`Received GitHub webhook request: ${ghNoun} :: ${action}: ${require('util').inspect({sender, repository: _.isObject(repository) ? repository.full_name : undefined, comment, label, issueOrPr}, {depth:null})}`);
if (
(ghNoun === 'issues' && ['opened','reopened'].includes(action))
@ -418,7 +418,7 @@ module.exports = {
}, baseHeaders);
} else if (!isPRStillDependentOnCeoReview && existingLabels.includes('#g-ceo')) {
// [?] https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#remove-a-label-from-an-issue
await sails.helpers.http.del(`https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/labels/${encodeURIComponent('#handbook')}`, {}, baseHeaders);
await sails.helpers.http.del(`https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/labels/${encodeURIComponent('#g-ceo')}`, {}, baseHeaders);
}//fi
// ┌─┐┬ ┬┌┬┐┌─┐ ┌─┐┌─┐┌─┐┬─┐┌─┐┬ ┬┌─┐ ┬ ┬ ┬┌┐┌┌─┐┬─┐┌─┐┌─┐┌─┐┌─┐
@ -453,7 +453,7 @@ module.exports = {
if (isMainBranchFrozen && repo === 'fleet') {
sails.pocketOfPrNumbersUnfrozen = _.union(sails.pocketOfPrNumbersUnfrozen, [ prNumber ]);
sails.log.info('#'+prNumber+' autoapproved, main branch is frozen... prNumbers unfrozen:',sails.pocketOfPrNumbersUnfrozen);
sails.log.verbose('#'+prNumber+' autoapproved, main branch is frozen... prNumbers unfrozen:',sails.pocketOfPrNumbersUnfrozen);
// [?] See May 6th, 2022 changelog, which includes this code sample:
// (https://www.mergefreeze.com/news)
@ -478,7 +478,7 @@ module.exports = {
if (isMainBranchFrozen && repo === 'fleet') {
sails.pocketOfPrNumbersUnfrozen = _.difference(sails.pocketOfPrNumbersUnfrozen, [ prNumber ]);
sails.log.info('#'+prNumber+' not autoapproved, main branch is frozen... prNumbers unfrozen:',sails.pocketOfPrNumbersUnfrozen);
sails.log.verbose('#'+prNumber+' not autoapproved, main branch is frozen... prNumbers unfrozen:',sails.pocketOfPrNumbersUnfrozen);
// [?] See explanation above.
await sails.helpers.http.post(`https://www.mergefreeze.com/api/branches/fleetdm/fleet/main?access_token=${encodeURIComponent(sails.config.custom.mergeFreezeAccessToken)}`, {