Skip to content

Commit

Permalink
Merge pull request #10 from Tigers-X/slackIntegration
Browse files Browse the repository at this point in the history
Slack integration
  • Loading branch information
diyorbekibragimov authored Jul 6, 2024
2 parents 7ec1d97 + 8011539 commit 511a3ad
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/TriageOpenIssue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
console.log('input: ', input)
const apiUrl = "http://140.211.168.122/recommendation";
const sandboxIssueNumber = 19673;
const sandboxIssueNumber = 1;
const sandboxOwner = context.repo.owner;
const sandboxRepo = context.repo.repo;
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/callSlack.yml
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

0 comments on commit 511a3ad

Please sign in to comment.