Skip to content

Commit

Permalink
Generate url for workflow for failure case
Browse files Browse the repository at this point in the history
  • Loading branch information
mukulmishra18 committed Jan 4, 2024
1 parent 543ddec commit ff683f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions .github/scripts/notifySlackTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/tag-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
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 }}

0 comments on commit ff683f9

Please sign in to comment.