From ff683f9c004baceb5bf8091541a9f098fce384c7 Mon Sep 17 00:00:00 2001 From: mukulmishra18 Date: Thu, 4 Jan 2024 13:13:04 +0530 Subject: [PATCH] Generate url for workflow for failure case --- .github/scripts/notifySlackTeam.js | 9 ++++++--- .github/workflows/release.yml | 2 +- .github/workflows/tag-release-version.yml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/scripts/notifySlackTeam.js b/.github/scripts/notifySlackTeam.js index 2e31a4dfc..e5f375aa5 100644 --- a/.github/scripts/notifySlackTeam.js +++ b/.github/scripts/notifySlackTeam.js @@ -4,8 +4,11 @@ const https = require('https'); const jobStatus = process.argv[2]; const changelogPath = process.argv[3]; const releaseVersion = process.argv[4]; -const slackChannelId = process.argv[5]; -const slackWebhookUrl = process.argv[6]; +const slackWebhookUrl = process.argv[5]; +const runId = process.argv[6]; +const jobId = process.argv[7]; + +const slackChannelId = 'C06BYVC27QU' fs.readFile(changelogPath, 'utf8', (err, fileContent) => { if (err) { @@ -33,7 +36,7 @@ function sendSlackMessage(slackChannelId, releaseVersion, changelogContent) { if (jobStatus === 'success') { message = `Changelog v${releaseVersion}\n${changelogContent}` } else { - message = `Release v${releaseVersion} failed.` + message = `Release v${releaseVersion} failed.\nPlease check https://github.com/bitmovin/bitmovin-player-ui/actions/runs/${runId}/job/${jobId}` } const sampleData = JSON.stringify({ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 364c55ed7..0aab42d52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,4 +35,4 @@ jobs: - name: Notify team run: | - node .github/scripts/notifySlackTeam.js 'success' 'CHANGELOG.md' '${{ fromJson(steps.define-release-version.outputs.result).full }}' 'C06BYVC27QU' ${{ secrets.RELEASE_SUCCESS_SLACK_WEBHOOK }} + node .github/scripts/notifySlackTeam.js 'success' 'CHANGELOG.md' '${{ fromJson(steps.define-release-version.outputs.result).full }}' ${{ secrets.RELEASE_SUCCESS_SLACK_WEBHOOK }} diff --git a/.github/workflows/tag-release-version.yml b/.github/workflows/tag-release-version.yml index 95db0c7dd..7b3d257d4 100644 --- a/.github/workflows/tag-release-version.yml +++ b/.github/workflows/tag-release-version.yml @@ -72,4 +72,4 @@ jobs: - name: Notify failure if: ${{ failure() }} run: | - node .github/scripts/notifySlackTeam.js 'failure' 'CHANGELOG.md' '${{ fromJson(steps.define-release-version.outputs.result).full }}' 'C06BYVC27QU' ${{ secrets.RELEASE_FAILURE_SLACK_WEBHOOK }} \ No newline at end of file + node .github/scripts/notifySlackTeam.js 'failure' 'CHANGELOG.md' '${{ fromJson(steps.define-release-version.outputs.result).full }}' ${{ secrets.RELEASE_FAILURE_SLACK_WEBHOOK }} ${{ github.run_id }} ${{ github.job }} \ No newline at end of file