summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/govulncheck.yml
blob: 2b46aa9b06e57758f45cf582b12b6fc8c0210529 (plain)
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
name: govulncheck

on:
  schedule:
    - cron: "0 12 * * *" # 8am EST / 10am PST / 12pm UTC
  workflow_dispatch: # allow manual trigger for testing
  pull_request:
    paths:
      - ".github/workflows/govulncheck.yml"

jobs:
  source-scan:
    runs-on: ubuntu-latest

    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Install govulncheck
        run: ./tool/go install golang.org/x/vuln/cmd/govulncheck@latest

      - name: Scan source code for known vulnerabilities
        run: PATH=$PWD/tool/:$PATH "$(./tool/go env GOPATH)/bin/govulncheck" -test ./...

      - name: Post to slack
        if: failure() && github.event_name == 'schedule'
        uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
        with:
          method: chat.postMessage
          token: ${{ secrets.GOVULNCHECK_BOT_TOKEN }}
          payload: |
            {
              "channel": "C08FGKZCQTW",
              "blocks": [
                {
                  "type": "section",
                  "text": {
                    "type": "mrkdwn",
                    "text": "Govulncheck failed in ${{ github.repository }}"
                  },
                  "accessory": {
                    "type": "button",
                    "text": {
                      "type": "plain_text",
                      "text": "View results"
                    },
                    "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
                  }
                }
              ]
            }