-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Tigers-X/slackIntegration
Slack integration
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Calling Slack | ||
run-name: Mentioning Teams in Slack based on the TriagerX recommendation | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
slack_notification: | ||
runs-on: ubuntu-latest | ||
if: github.event.comment.user.login == 'github-actions[bot]' && contains(github.event.comment.body, 'Recommended Components:') | ||
steps: | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install dependencies | ||
run: npm install axios | ||
|
||
- name: Make a request to the Slack server | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const axios = require('axios'); | ||
const commentBody = github.event.comment.body; | ||
const components = commentBody.split('Recommended Components:')[1].split('\n')[0].trim().split(', '); | ||
console.log(components); | ||
// for every component, send a message to the corresponding slack channel | ||
// tell the developers in the channel that the issue with number <n> needs to be reviewed | ||
// if possible, send a direcy link to the channel | ||