diff --git a/README.md b/README.md index d8c1590..f5b324e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ jobs: notification-summary: Your custom notification message notification-color: 17a2b8 timezone: America/Denver + verbose-logging: true ``` 3. Make it your own with the following configurations. @@ -39,6 +40,7 @@ jobs: - `notification-summary` (required), Your custom notification message (ex. Deployment Started or Build Successful) - `notification-color` (optional), Custom color to help distinguish type of notification. Can be any [HEX color](https://html-color.codes/). (ex. **007bff** or **17a2b8** for info, **28a745** success, **ffc107** warning, **dc3545** error, etc.) - `timezone` - (optional, defaults to `UTC`), a [valid database timezone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), (ex. Australia/Sydney or America/Denver, etc.) + - `verbose-logging` - (optional, defaults to `false`), Emits additional logging showing the sent message card and response from the webhook. ## Examples As you can see below, the `notification-summary` and `notification-color` are being used to customize the appearance of the message. Use bright vibrant colors to notify your Microsoft Teams channel of warnings or errors in your GitHub Actions workflow. diff --git a/action.yml b/action.yml index 83f7fd1..5b737f5 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,10 @@ inputs: timezone: description: 'Timezone (ex. America/Denver)' required: false + verbose-logging: + description: 'Enable verbose logging' + default: 'false' + required: false runs: using: 'node20' - main: 'dist/index.js' \ No newline at end of file + main: 'dist/index.js' diff --git a/src/main.ts b/src/main.ts index 34a3fd3..c72528f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,7 @@ async function run(): Promise { core.getInput('notification-summary') || 'GitHub Action Notification' const notificationColor = core.getInput('notification-color') || '0b93ff' const timezone = core.getInput('timezone') || 'UTC' - + const verboseLogging = core.getInput('verbose-logging') const timestamp = moment() .tz(timezone) .format('dddd, MMMM Do YYYY, h:mm:ss a z') @@ -55,12 +55,16 @@ async function run(): Promise { timestamp ) - console.log(messageCard) + if (verboseLogging) { + console.log(messageCard) + } axios .post(msTeamsWebhookUri, messageCard) .then(function (response) { - console.log(response) + if (verboseLogging) { + console.log(response) + } core.debug(response.data) }) .catch(function (error) {