Skip to content

Commit b90a914

Browse files
author
Tyler Titsworth
authored
OSSF patch (#7)
2 parents 70e752f + c1746c5 commit b90a914

File tree

6 files changed

+89
-11
lines changed

6 files changed

+89
-11
lines changed

.github/utils/val-args.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ input_string="$1"
77

88
# Use regex to find the line that contains '/test-group' and capture it
99
if [[ $input_string =~ /test-group(.*) ]]; then
10-
matched_line="${BASH_REMATCH[1]}"
10+
matched_line="${BASH_REMATCH[1]}"
1111
else
12-
# If the pattern is not found, exit
13-
echo "Error: The input string does not contain a line with '/test-group'."
14-
exit 1
12+
# If the pattern is not found, exit
13+
echo "Error: The input string does not contain a line with '/test-group'."
14+
exit 1
1515
fi
1616

1717
# Use regex to extract key-value pairs with the cases:
@@ -21,10 +21,10 @@ key_val_pairs=$(echo "$matched_line" | grep -oP "$regex" | sed 's/: /=/g')
2121

2222
# Check if there is at least one key-value pair
2323
if [[ -z "$key_val_pairs" ]]; then
24-
echo "Error: The matched line does not contain any valid key-value pairs."
25-
exit 1
24+
echo "Error: The matched line does not contain any valid key-value pairs."
25+
exit 1
2626
fi
2727

2828
# Print the key-value pairs
2929
echo "$key_val_pairs"
30-
echo "$key_val_pairs" >> "$GITHUB_OUTPUT"
30+
echo "$key_val_pairs" >>"$GITHUB_OUTPUT"

.github/workflows/lint.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ jobs:
1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
2123
- name: Super-linter
22-
uses: super-linter/super-linter/slim@v5.7.2
24+
uses: super-linter/super-linter/slim@v6.2.0
2325
env:
24-
DEFAULT_BRANCH: main
2526
# To report GitHub Actions status checks
2627
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
2728
GITHUB_ACTIONS_COMMAND_ARGS: '-ignore SC.*'
29+
VALIDATE_BASH_EXEC: false
30+
VALIDATE_CHECKOV: false
2831
VALIDATE_KUBERNETES_KUBECONFORM: false
2932
VALIDATE_NATURAL_LANGUAGE: false
3033
VALIDATE_PYTHON_FLAKE8: false

.github/workflows/ossf.yaml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '29 17 * * 4'
14+
push:
15+
branches: [ "main" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: k8-runners
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
# Uncomment the permissions below if installing in a private repository.
30+
contents: read
31+
actions: read
32+
33+
steps:
34+
- name: "Checkout code"
35+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
36+
with:
37+
persist-credentials: false
38+
39+
- name: "Run analysis"
40+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
41+
with:
42+
results_file: results.sarif
43+
results_format: sarif
44+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
45+
# - you want to enable the Branch-Protection check on a *public* repository, or
46+
# - you are installing Scorecard on a *private* repository
47+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
48+
repo_token: ${{ secrets.ACTION_TOKEN }}
49+
50+
# Public repositories:
51+
# - Publish results to OpenSSF REST API for easy access by consumers
52+
# - Allows the repository to include the Scorecard badge.
53+
# - See https://github.com/ossf/scorecard-action#publishing-results.
54+
# For private repositories:
55+
# - `publish_results` will always be set to `false`, regardless
56+
# of the value entered here.
57+
publish_results: true
58+
59+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
60+
# format to the repository Actions tab.
61+
- name: "Upload artifact"
62+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
63+
with:
64+
name: SARIF file
65+
path: results.sarif
66+
retention-days: 5
67+
68+
# Upload the results to GitHub's code scanning dashboard.
69+
- name: "Upload to code-scanning"
70+
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
71+
with:
72+
sarif_file: results.sarif

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ repos:
2727
rev: v0.9.0
2828
hooks:
2929
- id: shellcheck
30+
- repo: https://github.com/cisagov/pre-commit-shfmt
31+
rev: v0.0.2
32+
hooks:
33+
- id: shfmt
3034
- repo: https://github.com/ambv/black
3135
rev: 23.12.1
3236
hooks:

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.
1616
2. Create a new branch for your contribution: `git checkout -b feature/your-feature`.
1717
3. Install [pre-commit](https://pre-commit.com/), [Docker](https://docs.docker.com/engine/install/), and [Python 3.8+](https://www.python.org/downloads/).
1818
4. Follow the [Project Setup](README.md#project-setup) steps.
19-
5. Install the third-party python dependencies necessary for pre-commit with `pip install pytest pylint black`.
19+
5. Install the third-party python dependencies necessary for pre-commit with `pip install pytest pylint black shfmt-py`.
2020
6. Make your changes, commit, and sign your changes: `git commit -s -m 'Add your feature'`.
2121
7. Push to the branch: `git push origin feature/your-feature`.
2222
8. Submit a pull request.

classical-ml/tests/sklearn.sh

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
# For reference:
2727
# https://docs.docker.com/develop/develop-images/build_enhancements/
2828

29-
3029
wget https://raw.githubusercontent.com/intel/ai-containers/main/preset/classical-ml/tests/scikit/kmeans.py
3130
python kmeans.py true
3231

0 commit comments

Comments
 (0)