From bebeafc72eab03449b6fa4a5933ee4682aba85ea Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Fri, 18 Oct 2024 16:13:20 +0530 Subject: [PATCH] added the package version in the alert --- .github/actions/notify-slack/action.yml | 12 +++++- .github/workflows/publish.yml | 54 ++++++++++++------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/.github/actions/notify-slack/action.yml b/.github/actions/notify-slack/action.yml index 0f89a0a4..448a4c2a 100644 --- a/.github/actions/notify-slack/action.yml +++ b/.github/actions/notify-slack/action.yml @@ -20,6 +20,12 @@ inputs: button_type: required: true description: "color for the check logs button" + package_version: + required: true + description: "released package version" + repo_link: + required: true + description: "link of the repo" runs: @@ -66,11 +72,15 @@ runs: "fields": [ { "type": "mrkdwn", - "text": "*Repository:* \n ${{github.server_url}}/${{github.repository}}" + "text": "*Repository:* \n ${{inputs.repo_link}}" }, { "type": "mrkdwn", "text": "*Status:*\n ${{inputs.job_status}}" + }, + { + "type": "mrkdwn", + "text": "*Package Version:*\n ${{inputs.package_version}}" } ] }, diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 21928a1e..b5083a56 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,21 +21,21 @@ jobs: repository: XeroAPI/xero-node path: xero-node - # - name: Set up Node environment - # uses: actions/setup-node@v4 - # with: - # node-version: 20 - # cache: 'npm' - # cache-dependency-path: '**/package-lock.json' - # registry-url: 'https://registry.npmjs.org' + - name: Set up Node environment + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + registry-url: 'https://registry.npmjs.org' - # - name: Install dependencies - # run: npm ci - # working-directory: xero-node + - name: Install dependencies + run: npm ci + working-directory: xero-node - # - name: Run Build - # run: npm run build - # working-directory: xero-node + - name: Run Build + run: npm run build + working-directory: xero-node - name: Fetch Latest release number id: get_latest_release_number @@ -64,9 +64,6 @@ jobs: repository: XeroAPI/xero-node path: xero-node - - name: print release number - run: echo "release number - ${{needs.publish.outputs.release_number}}" - - name: Send slack notification on success uses: ./xero-node/.github/actions/notify-slack with: @@ -76,6 +73,8 @@ jobs: XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" button_type: "primary" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}} notify-slack-on-failure: runs-on: ubuntu-latest @@ -88,15 +87,14 @@ jobs: repository: XeroAPI/xero-node path: xero-node - - name: print release number - run: echo "release number - ${{needs.publish.outputs.release_number}}" - - # - name: Send slack notification on failure - # uses: ./xero-node/.github/actions/notify-slack - # with: - # heading_text: "Publish job has failed !" - # alert_type: "alert" - # job_status: "Failed" - # XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} - # job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - # button_type: "danger" + - name: Send slack notification on failure + uses: ./xero-node/.github/actions/notify-slack + with: + heading_text: "Publish job has failed !" + alert_type: "alert" + job_status: "Failed" + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + button_type: "danger" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}}