-
Notifications
You must be signed in to change notification settings - Fork 250
50 lines (47 loc) · 1.35 KB
/
gosec.yaml
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
name: Gosec
on:
# schedule:
# # This is meant to run every day at 9am
# - cron: '0 9 * * *'
push:
jobs:
gosec:
runs-on: ubuntu-latest
env:
GO111MODULE: on
outputs:
gosec-output: ${{ steps.gosec-run.outputs.gosec-output }}
steps:
- name: Checkout Source
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- name: Run Gosec
id: gosec-run
uses: securego/gosec@master
with:
# args: '-exclude=G104,G115,G304,G406,G507 -exclude-dir=builtin/gen ./...'
args: '-fmt json -exclude=G104,G115,G304,G406,G507 ./...'
- name: Capture Gosec Output
if: failure()
run: echo "gosec-output=$(echo "${{ steps.gosec-run.outputs.issues }}")" >> $GITHUB_OUTPUT
notify-slack:
name: Notify Slack
needs:
- gosec
if: always() && needs.gosec.outputs.gosec-output.found != 0
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Notify Slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.GOSEC_SLACK_WEBHOOK }}
with:
payload: |
{
"gosec-output": "${{ needs.gosec.outputs.gosec-output || 'No issues found' }}",
}