govulncheck.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. name: govulncheck
  2. on:
  3. schedule:
  4. - cron: "0 12 * * *" # 8am EST / 10am PST / 12pm UTC
  5. workflow_dispatch: # allow manual trigger for testing
  6. pull_request:
  7. paths:
  8. - ".github/workflows/govulncheck.yml"
  9. jobs:
  10. source-scan:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Check out code into the Go module directory
  14. uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
  15. - name: Install govulncheck
  16. run: ./tool/go install golang.org/x/vuln/cmd/govulncheck@latest
  17. - name: Scan source code for known vulnerabilities
  18. run: PATH=$PWD/tool/:$PATH "$(./tool/go env GOPATH)/bin/govulncheck" -test ./...
  19. - name: Post to slack
  20. if: failure() && github.event_name == 'schedule'
  21. uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
  22. with:
  23. method: chat.postMessage
  24. token: ${{ secrets.GOVULNCHECK_BOT_TOKEN }}
  25. payload: |
  26. {
  27. "channel": "C08FGKZCQTW",
  28. "blocks": [
  29. {
  30. "type": "section",
  31. "text": {
  32. "type": "mrkdwn",
  33. "text": "Govulncheck failed in ${{ github.repository }}"
  34. },
  35. "accessory": {
  36. "type": "button",
  37. "text": {
  38. "type": "plain_text",
  39. "text": "View results"
  40. },
  41. "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  42. }
  43. }
  44. ]
  45. }