Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ on:
branches:
- main
pull_request:
schedule: # Monday at 04:00 UTC
- cron: '0 4 * * Mon'

permissions:
contents: read
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/govulnfix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Govulnfix

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
schedule: # Monday at 04:00 UTC
- cron: '0 4 * * Mon'

jobs:
vulnfix:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
id: install-go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Download dependencies
run: go mod download
if: steps.install-go.outputs.cache-hit != 'true'

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

- name: Install vulnfix
run: go install github.com/hamba/vulnfix@latest

- name: Run govulncheck and update go.mod
# govulncheck exits 3 when vulnerabilities are found; pipeline should
# still reach vulnfix, so we use a subshell with pipefail disabled.
run: |
set +o pipefail
govulncheck -json ./... | tee /tmp/vuln.json | vulnfix -o /tmp/vuln.md

- name: Open Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: govulncheck/auto-fix
delete-branch: "true"
commit-message: "chore(deps): fix vulnerabilities reported by govulncheck"
title: "chore(deps): fix vulnerabilities reported by govulncheck"
body-path: /tmp/vuln.md
labels: security,dependencies
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
check-latest: true
check-latest: "true"

- name: Cache Go test cache
uses: actions/cache@v4
with:
path: /home/runner/.cache/go-test-cache
key: ${{ runner.os }}-go-testcache-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-testcache-

- name: Download dependencies
run: go mod download
Expand All @@ -58,6 +65,8 @@ jobs:

- name: Run Tests
run: gotestsum --format pkgname -- -covermode=atomic -coverprofile=coverage.out -race ./...
env:
GOCACHE: /home/runner/.cache/go-test-cache

- name: Coveralls
uses: coverallsapp/github-action@v2
Expand Down
Loading