From 5a0ac293f0a43f8198bad68fb136fda4339f9dfc Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:16:02 -0330 Subject: [PATCH 1/5] Send separate Slack notifications Update Slack notification to send notificationsbased on the GitHub build being successful or failed. --- .github/workflows/actions.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 46a5d8e..d2f0279 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -54,3 +54,26 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: steps.publish.outputs.type != 'none' && always() + + - name: Send Slack notification + if: steps.publish.outputs.type != 'none' && success() + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,workflow,took + text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SUCCESS_WEBHOOK_URL }} + + - name: Send Slack notification + if: steps.publish.outputs.type != 'none' && (failure() || cancelled()) + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,workflow,took + text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_FAILED_WEBHOOK_URL }} + From 373dba28aa3c8a2815d8113f79c9f72a553ccd06 Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:22:07 -0330 Subject: [PATCH 2/5] Upgrade GitHub actions Upgrade GitHub actions to latest version due to some current versions being deprecated. --- .github/workflows/actions.yml | 4 ++-- .github/workflows/pullRequests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index d2f0279..beebae1 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -8,7 +8,7 @@ jobs: name: Test & Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 @@ -17,7 +17,7 @@ jobs: - name: Cache node_modules id: cache-modules - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: node_modules key: 18.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }} diff --git a/.github/workflows/pullRequests.yml b/.github/workflows/pullRequests.yml index 377e391..996c244 100644 --- a/.github/workflows/pullRequests.yml +++ b/.github/workflows/pullRequests.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 @@ -19,7 +19,7 @@ jobs: - name: Cache node_modules id: cache-modules - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: node_modules key: 18.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }} From 858c21235eebbb173bc3b3cc7f41e627bd64ea89 Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:24:37 -0330 Subject: [PATCH 3/5] Remove origina Slack notification Remove the Slack notification being sent regardless of build outcome since notifications corresponding to successful or failed outcomes are being sent. --- .github/workflows/actions.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index beebae1..edc9a71 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -44,17 +44,6 @@ jobs: with: token: ${{ secrets.NPM_AUTH_TOKEN }} - - name: Send Slack notification - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo - text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: steps.publish.outputs.type != 'none' && always() - - name: Send Slack notification if: steps.publish.outputs.type != 'none' && success() uses: 8398a7/action-slack@v3 From 9ef6ac7a736506d78bd793e20715132335f5034f Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:26:27 -0330 Subject: [PATCH 4/5] Update package versions Update package and package-lock verions. --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 62cb16c..dd9f17d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@notificationapi/core", - "version": "0.0.10", + "version": "0.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@notificationapi/core", - "version": "0.0.10", + "version": "0.0.12", "devDependencies": { "@types/jest": "^29.5.3", "@types/node": "^20.14.10", From 333b1976ad78da1870e52f455e2d681be3618f2c Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:33:13 -0330 Subject: [PATCH 5/5] Correct jobs names for Slack notifications Change the name for the Slack notification jobs to signify what they do. --- .github/workflows/actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index edc9a71..58c8031 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -44,7 +44,7 @@ jobs: with: token: ${{ secrets.NPM_AUTH_TOKEN }} - - name: Send Slack notification + - name: Send Slack notification for Success if: steps.publish.outputs.type != 'none' && success() uses: 8398a7/action-slack@v3 with: @@ -55,7 +55,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SUCCESS_WEBHOOK_URL }} - - name: Send Slack notification + - name: Send Slack notification for Failure if: steps.publish.outputs.type != 'none' && (failure() || cancelled()) uses: 8398a7/action-slack@v3 with: