Skip to content

Commit 4d070ce

Browse files
committed
Avoid rate limiting on Trivy actions
The Git Hub Packages registry has been responding with errors: TOOMANYREQUESTS: retry-after: 172.466µs, allowed: 44000/minute
1 parent fc13b98 commit 4d070ce

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/trivy.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,27 @@ jobs:
1919
with: { go-version: stable }
2020
- run: go mod download
2121

22+
# Login to the GitHub Packages registry to avoid rate limiting.
23+
# - https://aquasecurity.github.io/trivy/v0.55/docs/references/troubleshooting/#github-rate-limiting
24+
# - https://github.com/aquasecurity/trivy/issues/7580
25+
# - https://github.com/aquasecurity/trivy-action/issues/389
26+
# - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
27+
# - https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
28+
- name: Login to GitHub Packages
29+
run: >
30+
docker login ghcr.io
31+
--username '${{ github.actor }}'
32+
--password-stdin <<< '${{ secrets.GITHUB_TOKEN }}'
33+
2234
# Report success only when detected licenses are listed in [/trivy.yaml].
2335
# The "aquasecurity/trivy-action" action cannot access the Go module cache,
2436
# so run Trivy from an image with the cache and local configuration mounted.
2537
# - https://github.com/aquasecurity/trivy-action/issues/219
2638
# - https://github.com/aquasecurity/trivy/pkgs/container/trivy
27-
- run: >
39+
- name: Scan licenses
40+
run: >
2841
docker run
42+
--env 'DOCKER_CONFIG=/docker' --volume "${HOME}/.docker:/docker"
2943
--env 'GOPATH=/go' --volume "$(go env GOPATH):/go"
3044
--workdir '/mnt' --volume "$(pwd):/mnt"
3145
'ghcr.io/aquasecurity/trivy:latest'

0 commit comments

Comments
 (0)