-
Notifications
You must be signed in to change notification settings - Fork 598
61 lines (57 loc) · 2.18 KB
/
security.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Security scan
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 9 * * *' # Same time as CI Cron
jobs:
build:
name: Trivy Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- name: Run Trivy in table mode
# Table output is only useful when running on a pull request or push.
if: contains(fromJSON('["push", "pull_request"]'), github.event_name)
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # tag v.0.28.0
with:
scan-type: fs
format: table
exit-code: 1
ignore-unfixed: true
severity: CRITICAL,HIGH,MEDIUM,LOW
- name: Run Trivy in report mode
# Only generate sarif when running nightly on the main branch.
if: ${{ github.event_name == 'schedule' }}
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # tag v.0.28.0
with:
scan-type: fs
format: template
template: '@/contrib/sarif.tpl'
output: trivy-results.sarif
ignore-unfixed: true
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
- name: Upload Trivy scan results to GitHub Security tab
# Only upload sarif when running nightly on the main branch.
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # tag v3.27.0
with:
sarif_file: trivy-results.sarif
notify_slack_fail:
name: Notify slack fail
needs: [build]
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'schedule' && failure() }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- uses: ./.github/actions/workflow-conclusion
- uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # tag v1.6.0
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.RUBY_GITHUB_ACTIONS_BOT_WEBHOOK }}
with:
channel: ruby-agent-notifications
status: FAILED
color: danger