Skip to content

Commit

Permalink
Update sample.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhilashKD authored May 2, 2024
1 parent 5fbd0d9 commit c355a3d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI/CD Pipeline

on:
push:
branches: dev
branches: [dev]

jobs:
build:
Expand All @@ -11,6 +11,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Trivy
run: |
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
Expand All @@ -21,8 +22,19 @@ jobs:
- name: Scan files with Trivy
run: |
trivy fs . > trivy-files.txt
# Assuming Trivy is already installed in the system
- name: Send scan reports via email
run: |
echo "Scan report attached." | mail -s "Trivy Scan Report" -A trivy-files.txt [email protected]
echo "Scan report attached." > body.txt
echo "From: [email protected]" > email.txt
echo "To: [email protected]" >> email.txt
echo "Subject: Trivy Scan Report" >> email.txt
echo "Content-Type: text/plain; charset=UTF-8" >> email.txt
echo "" >> email.txt
cat body.txt >> email.txt
sendmail -t < email.txt
env:
SMTP_SERVER: smtp.gmail.com
SMTP_PORT: 587
SMTP_USERNAME: [email protected]
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}

0 comments on commit c355a3d

Please sign in to comment.