Created
          March 1, 2023 02:08 
        
      - 
      
- 
        Save hendrixroa/8acab17c826c1dbeb0dc7790e73692d7 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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
    
  
  
    
  | private async sendSlackMessage(countVulnerabilities: number, packageName: string): Promise<void> { | |
| const postData = { | |
| attachments: [ | |
| { | |
| author_name: 'YARN - AUDIT', | |
| color: '#ff0000', | |
| mrkdwn_in: ['text', 'pretext'], | |
| text: `Found *${countVulnerabilities}* vulnerabilities in _${packageName}_ project, for more details run _yarn audit_`, | |
| }, | |
| ], | |
| channel: `#packages-vulnerabilities`, | |
| icon_emoji: ':warning:', | |
| mrkdwn: true, | |
| username: 'YARN Audit Alert', | |
| }; | |
| const result = await this.client.post('', { | |
| body: postData, | |
| }); | |
| if (!result.ok) { | |
| throw new Error('The message cannot be delivered'); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment