Skip to content

Commit 84abfb1

Browse files
committed
ci: 升级 Actions 到 Node 24 运行时
- 将 checkout、setup-dotnet、setup-node 和 upload-artifact 升级到支持 Node 24 的版本。 - 将 CodeQL workflow 从 v3 升级到 v4,消除 CodeQL v3 弃用风险。 - 用校验 checksum 的 gitleaks Linux CLI 执行替代 gitleaks-action,避免继续依赖 Node 20 action。 - 将 anchore/sbom-action 固定到 v0.24.0,明确使用支持 Node 24 的版本。
1 parent 2d75049 commit 84abfb1

4 files changed

Lines changed: 34 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
2222

2323
- name: Setup .NET
24-
uses: actions/setup-dotnet@v4
24+
uses: actions/setup-dotnet@v5
2525
with:
2626
dotnet-version: 10.0.x
2727

.github/workflows/codeql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ jobs:
2929

3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@v6
3333

3434
- name: Setup .NET
3535
if: matrix.language == 'csharp'
36-
uses: actions/setup-dotnet@v4
36+
uses: actions/setup-dotnet@v5
3737
with:
3838
dotnet-version: 10.0.x
3939

4040
- name: Initialize CodeQL
41-
uses: github/codeql-action/init@v3
41+
uses: github/codeql-action/init@v4
4242
with:
4343
languages: ${{ matrix.language }}
4444

4545
- name: Autobuild
46-
uses: github/codeql-action/autobuild@v3
46+
uses: github/codeql-action/autobuild@v4
4747

4848
- name: Analyze
49-
uses: github/codeql-action/analyze@v3
49+
uses: github/codeql-action/analyze@v4
5050
with:
5151
category: "/language:${{ matrix.language }}"

.github/workflows/security.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,42 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
2626
with:
2727
fetch-depth: 0
2828

29-
- name: Gitleaks
30-
uses: gitleaks/gitleaks-action@v2
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Install Gitleaks
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
version="8.30.1"
34+
asset="gitleaks_${version}_linux_x64.tar.gz"
35+
base_url="https://github.com/gitleaks/gitleaks/releases/download/v${version}"
36+
tmp_dir="$(mktemp -d)"
37+
38+
curl --fail --location --retry 3 --retry-delay 2 --output "$tmp_dir/$asset" "$base_url/$asset"
39+
curl --fail --location --retry 3 --retry-delay 2 --output "$tmp_dir/checksums.txt" "$base_url/gitleaks_${version}_checksums.txt"
40+
41+
checksum_line="$(grep " ${asset}$" "$tmp_dir/checksums.txt")"
42+
printf '%s\n' "$checksum_line" | (cd "$tmp_dir" && sha256sum --check --strict)
43+
tar -xzf "$tmp_dir/$asset" -C "$tmp_dir" gitleaks
44+
echo "$tmp_dir" >> "$GITHUB_PATH"
45+
46+
- name: Run Gitleaks
47+
run: gitleaks detect --source . --redact --no-banner --config .gitleaks.toml
3348

3449
secrets-and-sbom:
3550
name: secrets-and-sbom
3651
runs-on: windows-latest
3752

3853
steps:
3954
- name: Checkout
40-
uses: actions/checkout@v4
55+
uses: actions/checkout@v6
4156
with:
4257
fetch-depth: 0
4358

4459
- name: Setup .NET
45-
uses: actions/setup-dotnet@v4
60+
uses: actions/setup-dotnet@v5
4661
with:
4762
dotnet-version: 10.0.x
4863

@@ -56,14 +71,14 @@ jobs:
5671
run: dotnet dotnet-CycloneDX CodexCliPlus.sln -o artifacts/sbom -fn codexcliplus.cyclonedx.xml
5772

5873
- name: Generate Syft SBOM
59-
uses: anchore/sbom-action@v0
74+
uses: anchore/sbom-action@v0.24.0
6075
with:
6176
path: .
6277
format: cyclonedx-json
6378
output-file: artifacts/sbom/codexcliplus.syft.cyclonedx.json
6479

6580
- name: Upload SBOM artifacts
66-
uses: actions/upload-artifact@v4
81+
uses: actions/upload-artifact@v7
6782
with:
6883
name: sbom
6984
path: artifacts/sbom

.github/workflows/tooling.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
2222

2323
- name: Setup .NET
24-
uses: actions/setup-dotnet@v4
24+
uses: actions/setup-dotnet@v5
2525
with:
2626
dotnet-version: 10.0.x
2727

2828
- name: Setup Node
29-
uses: actions/setup-node@v4
29+
uses: actions/setup-node@v6
3030
with:
3131
node-version: 24
3232
cache: npm

0 commit comments

Comments
 (0)