Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newpull #42

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
43 changes: 43 additions & 0 deletions .github/workflows/snyk-security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Example workflow for Python using Snyk
on: push

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/python@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: code test
args: --sarif-file-output=snyk.sarif
- name: Count total number of vulnerabilities
id: count_vulns
run: |
RESULTS_LENGTH=$(jq '.runs[0].results | length' snyk.sarif)
echo "RESULTS_LENGTH=$RESULTS_LENGTH" >> $GITHUB_ENV
echo "::set-output name=results_length::$RESULTS_LENGTH"
- name: Pass_or_Fail_the_job
run: |
if [ "$RESULTS_LENGTH" -ne 0 ]; then
echo "Job Failed"
exit 1
else
echo "Pass"
fi

notify:
runs-on: ubuntu-latest
needs: [security]
if: always()
steps:
- name: Send notification to Microsoft Teams
run: |
curl -H 'Content-Type: application/json' -d '{
"text": "**The Snyk scan result for repo is:** '"${{ needs.security.result }}"'",
"**Number of vulnerabilities:** '"${{ needs.security.outputs.count_vulns.results_length }}"'",
"**Detail:** https://github.com/'"${{ github.repository }}"'/actions/runs/'"${{ github.run_id }}"'"
}' ${{ secrets.TEAMS_WEBHOOK_URL }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:xenial-20210416
RUN apt-get update && apt-get install -y python python-pip
RUN pip install flask
COPY app.py /opt/
Expand Down