From cd469c50732e0f970a07d85c67efce5bd7252010 Mon Sep 17 00:00:00 2001 From: Diyorbek Ibragimov Date: Sat, 6 Jul 2024 16:47:36 +0500 Subject: [PATCH 1/2] testing slack --- .github/workflows/callSlack.yml | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/callSlack.yml diff --git a/.github/workflows/callSlack.yml b/.github/workflows/callSlack.yml new file mode 100644 index 00000000000..223076e9283 --- /dev/null +++ b/.github/workflows/callSlack.yml @@ -0,0 +1,36 @@ +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 + + From 80115397021f21386b52cb30d0b811153119f5f8 Mon Sep 17 00:00:00 2001 From: Diyorbek Ibragimov Date: Sat, 6 Jul 2024 16:50:09 +0500 Subject: [PATCH 2/2] changed the sandox number --- .github/workflows/TriageOpenIssue.yml | 2 +- .github/workflows/callSlack.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 index 223076e9283..0592e1cd013 100644 --- a/.github/workflows/callSlack.yml +++ b/.github/workflows/callSlack.yml @@ -32,5 +32,6 @@ jobs: // 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 +