Skip to content

Code scanning - chore: sync dependabot-auto-approve with github-actions-help reference #57

Code scanning - chore: sync dependabot-auto-approve with github-actions-help reference

Code scanning - chore: sync dependabot-auto-approve with github-actions-help reference #57

Workflow file for this run

name: Code scanning
run-name: "Code scanning - ${{ github.event.pull_request.title || format('{0} #{1}', github.ref_name, github.run_number) }}"
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
security-events: write
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Lint
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.0.2
with:
version: v2.11.2
args: |
--output.sarif.path golangci-lint-report.sarif
- name: Upload linting SARIF
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
sarif_file: golangci-lint-report.sarif
govulncheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Golang
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: tools/go.mod
cache: false
- name: Compute build cache key
id: build-cache-key
run: |
checksum=$(
{
cat tools/go.mod tools/go.sum Makefile
find . -type f -name '*.go' \
-not -path './tools/*' \
-print0 | sort -z | xargs -0 cat
} | md5sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"
- name: Cache Go module cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/go/pkg/mod
key: govulncheck-go-mod-${{ runner.os }}-${{ hashFiles('tools/go.sum') }}
- name: Cache Go build cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/go-build
key: govulncheck-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }}
restore-keys: |
govulncheck-go-build-${{ runner.os }}-
- name: Run vulnerability scan
run: make static-analysis/vulncheck/sarif
- name: Upload vulnerability SARIF
if: always()
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
sarif_file: build/govulncheck-report.sarif