Skip to content

Commit 7ee8ab6

Browse files
authored
Create golang-scanner.yaml
0 parents  commit 7ee8ab6

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: GO Security Checks
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
8+
jobs:
9+
# Job for running govulncheck https://github.com/golang/govulncheck-action
10+
govulncheck_job:
11+
env:
12+
SLACK_WEBHOOK_URL: ${{ secrets.SAST_SECURITY_SLACK_WEBHOOK}}
13+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
14+
GVC_PR_URL: ${{ github.event.pull_request.html_url }}
15+
GVC_PR_CREATOR: ${{ github.event.pull_request.user.login }}
16+
GVC_HEAD_COMMIT: ${{ github.event.pull_request.html_url }}/commits/${{ github.event.pull_request.head.sha }}
17+
GVC_WORKFLOW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
18+
GVC_SENDER: ${{ github.event.sender.login }}
19+
20+
runs-on: ubuntu-latest
21+
name: Run govulncheck
22+
steps:
23+
- name: Run govulncheck
24+
uses: golang/govulncheck-action@7da72f730e37eeaad891fcff0a532d27ed737cd4
25+
with:
26+
go-version-file: ./go.mod
27+
go-package: ./...
28+
29+
- name: Send Slack Notification
30+
if: failure()
31+
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
32+
with:
33+
# For posting a rich message using Block Kit
34+
payload: |
35+
{
36+
"blocks": [
37+
{
38+
"type": "section",
39+
"text": {
40+
"type": "mrkdwn",
41+
"text": ":red-alert: *Govulncheck Scan Failed*"
42+
}
43+
},
44+
{
45+
"type": "section",
46+
"text": {
47+
"type": "mrkdwn",
48+
"text": "`Workflow Run:` ${{ env.GVC_WORKFLOW_RUN_URL }}\n\n`Pull Request:` ${{ env.GVC_PR_URL }}\n\n`Head Commit:` ${{ env.GVC_HEAD_COMMIT }}\n\n`PR Creator:` *${{ env.GVC_PR_CREATOR }}*\n\n`Latest Committer:` *${{ env.GVC_SENDER }}*\n\n"
49+
}
50+
}
51+
]
52+
}

0 commit comments

Comments
 (0)