restructuring logic and adding more inputs #2

Merged
jake merged 12 commits from cleanup into main 2026-04-03 20:09:13 +00:00
2 changed files with 15 additions and 4 deletions
Showing only changes of commit f83527aa2d - Show all commits

View File

@@ -50,3 +50,8 @@ runs:
- name: "run security checks"
shell: bash
run: ${{ github.action_path }}/src/security.sh
env:
STATIC_FLAG: ${{ inputs.static }}
STATIC_FAIL: ${{ inputs.static-fail }}
VULN_CHECK: ${{ inputs.vulnerability }}
VULN_FAIL: ${{ inputs.vulnerability-fail }}

View File

@@ -2,13 +2,19 @@
set -eo pipefail
if [[ "$STATIC_FLAG" == "no" && "$VULN_SCAN" == "no" ]]; then
if [[ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]]; then
echo "[INFO] no security flags set, skipping!";
exit 0;
fi
toolchain=$(go mod edit go.mod -json | jq ".Toolchain");
version=$(go mod edit -json | jq ".Toolchain");
if [[ ! -z "$toolchain" ]]; then
version=$toolchain;
fi
if [[ "$STATIC_FLAG" == "yes" ]]; then
if gosec ./...; then
if GOTOOLCHAIN=$version gosec ./...; then
echo "[INFO] gosec passed!";
else
if [[ "$STATIC_FAIL" == "yes" ]]; then
@@ -21,7 +27,7 @@ if [[ "$STATIC_FLAG" == "yes" ]]; then
fi
if [[ "$VULN_CHECK" == "yes" ]]; then
if govulncheck ./...; then
if GOTOOLCHAIN=$version govulncheck ./...; then
echo "[INFO] govulncheck passed!";
else
if [[ "$VULN_FAIL" == "yes" ]]; then