Skip to content

Commit 6d4cbf7

Browse files
Scorecard implementation
1 parent 51fbd81 commit 6d4cbf7

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build project
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java: [11, 17]
16+
name: "Java ${{ matrix.java }} build"
17+
steps:
18+
- name: Checkout project
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
- name: Set up Java
21+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
22+
with:
23+
distribution: "temurin"
24+
java-version: "${{ matrix.java }}"
25+
cache: "maven"
26+
- name: Verify build
27+
run: mvn -B verify
28+
sonar:
29+
needs: build
30+
if: github.base_ref == 'main' && github.event_name == 'pull_request'
31+
name: Prepare analysis context
32+
uses: WrenSecurity/.github/.github/workflows/sonar-pull-prepare.yml@main
33+
with:
34+
pull_request: ${{ toJSON(github.event.pull_request) }}

.github/workflows/scorecard.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Scorecard supply-chain security
2+
on:
3+
branch_protection_rule:
4+
schedule:
5+
- cron: '45 0 * * 1'
6+
push:
7+
branches: [ "main" ]
8+
9+
permissions: read-all
10+
11+
jobs:
12+
analysis:
13+
name: Scorecard analysis
14+
runs-on: ubuntu-latest
15+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
16+
permissions:
17+
security-events: write
18+
id-token: write
19+
20+
steps:
21+
- name: "Checkout code"
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
25+
26+
- name: "Run analysis"
27+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
28+
with:
29+
results_file: results.sarif
30+
results_format: sarif
31+
publish_results: true
32+
33+
- name: "Upload artifact"
34+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
35+
with:
36+
name: SARIF file
37+
path: results.sarif
38+
retention-days: 5
39+
40+
- name: "Upload to code-scanning"
41+
uses: github/codeql-action/upload-sarif@v3
42+
with:
43+
sarif_file: results.sarif

0 commit comments

Comments
 (0)