Skip to content

Commit d1a500f

Browse files
authored
Create scorecard.yml (opea-project#1980)
Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com>
1 parent d83ddac commit d1a500f

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

.github/workflows/scorecard.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This workflow uses actions that are not certified by GitHub. They are provided
5+
# by a third-party and are governed by separate terms of service, privacy
6+
# policy, and support documentation.
7+
8+
name: Scorecard supply-chain security
9+
on:
10+
# For Branch-Protection check. Only the default branch is supported. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
12+
branch_protection_rule:
13+
# To guarantee Maintained check is occasionally updated. See
14+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
15+
schedule:
16+
- cron: '18 7 * * 3'
17+
push:
18+
branches: [ "main" ]
19+
20+
# Declare default permissions as read only.
21+
permissions: read-all
22+
23+
jobs:
24+
analysis:
25+
name: Scorecard analysis
26+
runs-on: ubuntu-latest
27+
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
28+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
29+
permissions:
30+
# Needed to upload the results to code-scanning dashboard.
31+
security-events: write
32+
# Needed to publish results and get a badge (see publish_results below).
33+
id-token: write
34+
# Uncomment the permissions below if installing in a private repository.
35+
# contents: read
36+
# actions: read
37+
38+
steps:
39+
- name: "Checkout code"
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
persist-credentials: false
43+
44+
- name: "Run analysis"
45+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
46+
with:
47+
results_file: results.sarif
48+
results_format: sarif
49+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
50+
# - you want to enable the Branch-Protection check on a *public* repository, or
51+
# - you are installing Scorecard on a *private* repository
52+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
53+
repo_token: ${{ secrets.ACTION_TOKEN }}
54+
55+
# Public repositories:
56+
# - Publish results to OpenSSF REST API for easy access by consumers
57+
# - Allows the repository to include the Scorecard badge.
58+
# - See https://github.com/ossf/scorecard-action#publishing-results.
59+
# For private repositories:
60+
# - `publish_results` will always be set to `false`, regardless
61+
# of the value entered here.
62+
publish_results: true
63+
64+
# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
65+
# file_mode: git
66+
67+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
68+
# format to the repository Actions tab.
69+
- name: "Upload artifact"
70+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
71+
with:
72+
name: SARIF file
73+
path: results.sarif
74+
retention-days: 5
75+
76+
# Upload the results to GitHub's code scanning dashboard (optional).
77+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
78+
- name: "Upload to code-scanning"
79+
uses: github/codeql-action/upload-sarif@v3
80+
with:
81+
sarif_file: results.sarif

0 commit comments

Comments
 (0)