-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fbd0d9
commit c355a3d
Showing
1 changed file
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: CI/CD Pipeline | |
|
||
on: | ||
push: | ||
branches: dev | ||
branches: [dev] | ||
|
||
jobs: | ||
build: | ||
|
@@ -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 - | ||
|
@@ -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 }} |