Skip to content

Commit 81fce1c

Browse files
committed
修复:GitHub Actions 中 gosec 安装问题
- 替换失败的 go install 方式为二进制下载 - 使用 GitHub API 获取最新版本号 - 确保在 CI 环境中能够正常安装 gosec 安全扫描工具
1 parent 0f902b1 commit 81fce1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,12 @@ jobs:
161161

162162
- name: Run Gosec Security Scanner
163163
run: |
164-
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
165-
gosec -fmt json -out gosec-report.json ./...
164+
# 下载并安装 gosec 二进制文件
165+
GOSEC_VERSION=$(curl -s "https://api.github.com/repos/securecodewarrior/gosec/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
166+
wget "https://github.com/securecodewarrior/gosec/releases/download/${GOSEC_VERSION}/gosec_${GOSEC_VERSION#v}_linux_amd64.tar.gz"
167+
tar -xzf "gosec_${GOSEC_VERSION#v}_linux_amd64.tar.gz"
168+
chmod +x gosec
169+
./gosec -fmt json -out gosec-report.json ./...
166170
167171
- name: Upload Gosec report
168172
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)