diff --git a/.github/workflows/TriageOpenIssue.yml b/.github/workflows/TriageOpenIssue.yml index 49a03f5187c..ad225becfab 100644 --- a/.github/workflows/TriageOpenIssue.yml +++ b/.github/workflows/TriageOpenIssue.yml @@ -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; diff --git a/.github/workflows/callSlack.yml b/.github/workflows/callSlack.yml new file mode 100644 index 00000000000..0592e1cd013 --- /dev/null +++ b/.github/workflows/callSlack.yml @@ -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 needs to be reviewed + // if possible, send a direcy link to the channel + +