1+ name : Secrets Scan
2+ on :
3+ pull_request :
4+ types : [opened, synchronize, reopened]
5+ jobs :
6+ security-secrets :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v2
10+ with :
11+ fetch-depth : 0
12+
13+ - name : Install Expect, jq and Python
14+ run : sudo apt-get install -y expect jq python3 python3-pip wkhtmltopdf
15+
16+ - name : Install Python packages
17+ run : pip install pandas json2html tabulate
18+
19+ - name : Install Talisman
20+ run : |
21+ curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/v1.32.0/install.sh > install.bash
22+ chmod +x install.bash
23+ ./install.bash
24+
25+ - name : Run Talisman
26+ id : run_talisman
27+ run : /usr/local/bin/talisman --scan
28+ continue-on-error : true
29+
30+ - name : Convert JSON to HTML
31+ run : |
32+ python3 -c "
33+ import json
34+ import os
35+ from json2html import *
36+ with open('talisman_report/talisman_reports/data/report.json') as f:
37+ data = json.load(f)
38+ html = json2html.convert(json = data)
39+ os.makedirs('talisman_html_report', exist_ok=True)
40+ with open('talisman_html_report/report.html', 'w') as f:
41+ f.write(html)
42+ " && wkhtmltopdf talisman_html_report/report.html talisman_report.pdf
43+
44+ - name : Upload Report
45+ id : upload_report
46+ uses : actions/upload-artifact@v4
47+ with :
48+ name : talisman-report-pdf
49+ path : talisman_report.pdf
50+
51+ - name : Check the status of talisman scan
52+ run : |
53+ # if [[ ${{ steps.run_talisman.outcome }} == "success" ]]; then exit 0; else echo "Download the Talisman scan report from Artifact: ${{ steps.upload_report.outputs.artifact-url }}" && exit 1; fi
54+ echo "Download the Talisman scan report from Artifact: ${{ steps.upload_report.outputs.artifact-url }}";
0 commit comments