Skip to content

Commit

Permalink
fix: [#87] Optional GCI (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbp-bvanb authored Oct 21, 2024
1 parent 32d0d6c commit b29a297
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ and a [.golangci.yml](https://golangci-lint.run/usage/configuration/).
| Option | Default | Required | Description |
| :--------------------------------- | :----------------------------------- | -------- | :--------------------------------------------------------------------------------------------------------------- |
| code_coverage_expected | 80 | | |
| gci | true | | Check for 'incorrect import order'. If failed then instructions are shown to resolve the issue |
| golang-unit-tests-exclusions | ' ' | | |
| golangci-lint-version | v1.55.2 | | |
| golang-number-of-tests-in-parallel | 4 | | |
Expand Down
29 changes: 26 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ description: |
The Mission Critical Vulnerability Scanner (MCVS) Golang action.
inputs:
code_coverage_expected:
default: "80"
description: |
The minimum code coverage.
default: "80"
gci:
default: "true"
description: |
Whether to check gci. Disable if the project provides an alternative way.
golang-unit-tests-exclusions:
default: " "
description: |
The Golang paths that should be excluded from unit testing.
default: " "
golangci-lint-version:
default: v1.55.2
description: |
The Golangci-lint version that has to be installed and used.
default: v1.55.2
golang-number-of-tests-in-parallel:
description: |
Number of test in parallel.
Expand Down Expand Up @@ -65,6 +69,7 @@ runs:
# but it does not provide clarity how to resolve it when positive.
#
- name: gci
if: inputs.gci == 'true'
shell: bash
run: |
go install github.com/daixiang0/[email protected]
Expand All @@ -85,11 +90,17 @@ runs:
severity-cutoff: high
- uses: 030/[email protected]
- name: Log in to GitHub Packages Docker registry
if: inputs.token != ''
shell: bash
run: |
echo "${{ inputs.token }}" |\
docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
# Duplicated trivy-action parameters as dependabot does NOT support
# anchors: https://github.com/actions/runner/issues/1182
#
- uses: aquasecurity/[email protected]
if: inputs.token != ''
env:
TRIVY_DB_REPOSITORY: ${{ inputs.trivy-action-db }}
TRIVY_JAVA_DB_REPOSITORY: ${{ inputs.trivy-action-java-db }}
Expand All @@ -102,6 +113,18 @@ runs:
ignore-unfixed: true
severity: "CRITICAL,HIGH"
trivyignores: .trivyignore
- uses: aquasecurity/[email protected]
if: inputs.token == ''
env:
TRIVY_DB_REPOSITORY: ${{ inputs.trivy-action-db }}
TRIVY_JAVA_DB_REPOSITORY: ${{ inputs.trivy-action-java-db }}
with:
scan-type: "fs"
scan-ref: "."
exit-code: "1"
ignore-unfixed: true
severity: "CRITICAL,HIGH"
trivyignores: .trivyignore
#
# Run golangci-lint.
#
Expand Down

0 comments on commit b29a297

Please sign in to comment.