From bdcfb73646b9ce87c6749743714f23401f2aea66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AC=E3=82=AF=E3=82=B5=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=2Eeth?= Date: Mon, 27 Nov 2023 11:23:18 +0900 Subject: [PATCH] chore: update push event logging messages --- src/handlers/push/check-modified-base-rate.ts | 5 ++--- src/handlers/push/push.ts | 14 +++++++------- tsconfig.json | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/handlers/push/check-modified-base-rate.ts b/src/handlers/push/check-modified-base-rate.ts index 9340d6874..69ac0ed86 100644 --- a/src/handlers/push/check-modified-base-rate.ts +++ b/src/handlers/push/check-modified-base-rate.ts @@ -10,14 +10,14 @@ export async function checkModifiedBaseRate(context: Context) { // if zero sha, push is a pr change if (payload.before === ZERO_SHA) { - logger.debug("Skipping push events, a new branch was created"); + logger.info("Skipping push events. A new branch was created"); } const changes = getCommitChanges(payload.commits); // skip if empty if (changes && changes.length === 0) { - logger.debug("Skipping push events, file change empty 1"); + logger.info("No files were changed in the commits, so no action is required."); } // check for modified or added files and check for specified file @@ -25,5 +25,4 @@ export async function checkModifiedBaseRate(context: Context) { // update base rate await updateBaseRate(context, BASE_RATE_FILE); } - logger.debug("Skipping push events, file change empty 2"); } diff --git a/src/handlers/push/push.ts b/src/handlers/push/push.ts index d21b61c82..46e8d63bd 100644 --- a/src/handlers/push/push.ts +++ b/src/handlers/push/push.ts @@ -2,11 +2,11 @@ import { Context as ProbotContext } from "probot"; import Runtime from "../../bindings/bot-runtime"; import { DefinedError } from "ajv"; +import { createCommitComment } from "../../helpers/commit"; +import { getFileContent } from "../../helpers/file"; import { BotConfig, validateBotConfig } from "../../types/configuration-types"; import { CommitsPayload, PushPayload } from "../../types/payload"; import { parseYaml, transformConfig } from "../../utils/generate-configuration"; -import { createCommitComment } from "../../helpers/commit"; -import { getFileContent } from "../../helpers/file"; export const ZERO_SHA = "0000000000000000000000000000000000000000"; export const BASE_RATE_FILE = ".github/ubiquibot-config.yml"; @@ -32,7 +32,7 @@ export async function validateConfigChange(context: ProbotContext) { const payload = context.payload as PushPayload; if (!payload.ref.startsWith("refs/heads/")) { - logger.debug("Skipping push events, not a branch"); + logger.info("Skipping push events, not a branch"); return; } @@ -40,7 +40,7 @@ export async function validateConfigChange(context: ProbotContext) { // skip if empty if (changes && changes.length === 0) { - logger.debug("Skipping push events, file change empty 3"); + logger.info("Skipping push events as there are no file changes in the latest commit."); return; } @@ -50,7 +50,7 @@ export async function validateConfigChange(context: ProbotContext) { .filter((commit) => commit.modified.includes(BASE_RATE_FILE) || commit.added.includes(BASE_RATE_FILE)) .reverse()[0]?.id; if (!commitSha) { - logger.debug("Skipping push events, commit sha not found"); + logger.info("Skipping push events, commit SHA not found"); return; } @@ -88,11 +88,11 @@ export async function validateConfigChange(context: ProbotContext) { logger.info("Config validation failed!", errorMsg); await createCommitComment(context, errorMsg, commitSha, BASE_RATE_FILE); } else { - logger.debug(`Config validation passed!`); + logger.info(`Config validation passed!`); } } } else { - logger.debug(`Skipping push events, file change doesn't include config file: ${JSON.stringify(changes)}`); + logger.info(`Skipping push events, file change doesn't include config file.`, changes); } } diff --git a/tsconfig.json b/tsconfig.json index b9259e753..972bb7a62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "incremental": false /* Enable incremental compilation */, "target": "ESNEXT" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - "lib": ["DOM", "ESNext"] /* Specify library files to be included in the compilation. */, + "lib": ["DOM", "ESNext", "es2021"] /* Specify library files to be included in the compilation. */, "allowJs": true /* Allow javascript files to be compiled. */, "checkJs": true /* Report errors in .js files. */, // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */