fix(ci): allow disabling licensei checks by env var and cache dependencies license information to avoid GitHub API rate limiting (#412)

This commit is contained in:
Patrick Decat 2023-09-18 14:25:42 +02:00 committed by GitHub
parent c2fd0562c1
commit f9e4bd0211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View File

@ -201,8 +201,33 @@ jobs:
run: |
make deps
- name: Restore cache license information of dependencies
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ".licensei.cache"
key: licensei-cache-${{ hashFiles('go.sum') }}
restore-keys: |
licensei-cache-
- name: Determine Go version
id: go
uses: ./.github/actions/go-version
- name: Install Go toolchain
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ steps.go.outputs.version }}
- name: Run licensei
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make license-check
if: env.LICENSE_CHECK != 'false'
- name: Save cache license information of dependencies
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
if: always()
with:
path: ".licensei.cache"
key: licensei-cache-${{ hashFiles('go.sum') }}

3
.gitignore vendored
View File

@ -28,3 +28,6 @@ coverage.txt
# GoReleaser build directory
dist/
# Licensei cache file
.licensei.cache

View File

@ -56,8 +56,11 @@ website/build-local:
.PHONY: license-check
license-check:
go mod vendor
licensei check
licensei header
licensei cache --debug
licensei check --debug
licensei header --debug
rm -rf vendor/
git diff --exit-code
# Install dependencies
deps: bin/licensei